代码如下:(望赏),有问题可以追问
#include<stdio.h>使用c语言,不是c++,,,,,我是新手是不有区别。。
追答有区别
C是C,C++是C++,千万别认为是一个东西。
如果你希望未来参与到大型系统的项目中,那么就学C++。
如果你希望未来做驱动或高性能的底层服务,就学C。
当然C++和C在很多层面有交集,甚至C++语法上99%的兼容C(不是100%完全兼容哟)。但是C++和C主要在理念上其实存在巨大分歧。
语法层面的问题永远不是大问题。
C是易学难精。
C++是难学难精。
给你一个C版本的:
#include
int main()
{
int max=0, min=0, total=0, count=0;
while(true){
int tmp=0;
int ret = scanf("%d",&tmp);
if(ret == 0){
printf("\n非整数输入,退出输入状态!\n\n");
break;
}
count++;
total += tmp;
if(count==1){
max = tmp;
min = tmp;
} else{
min=mintmp?max:tmp;
}
}
printf("共输入%d个有效数字:\n 总数=%d\n最大数=%d\n最小数=%d\n",count, total, max, min);
}
使用c语言,不是c++,,,,,我是新手是不有区别。。
追答可是你的问题上写的是c++......题目“输入任意数量整数,输出输入整数中的最大数,最小数,和总和”这个程序用c++怎么编写,越简单越好~