#include
using namespace std;
int main()
{
float avg;
int b,max,t,m,i,k,a[100];
t=0;
m=0;
i=0;
cout<<"please input the mumbers";
do
{
cin>>a[i];
i++;
m++;
}
while(cin.get()!='/n');
if(i==1)
{
cout<<"max=0"<<","<<"avg=0";
return 0;
}
max=a[0];
for(i=0;i<=m-1;i++)
{
if(a[i]>=a[i+1])
{
k=a[i];
a[i]=a[i+1];
a[i+1]=k;
}
}
max=a[m-1];
cout<<"nax="<<max<<",";
for(i=0;i<=m-1;i++)
t=t+a[i];
avg=t/m;
cout<<"avg="<<avg;</span><br /><span style="display:inline-block;text-indent:2em;"> return 0;
}
错误信息Compile error: /storage/emulated/0/Android/data/com.cscjapp.cppide/files/CJ_IDE/CPPProject/1/src/Main.cpp:17:22: warning: multi-character character constant [-Wmultichar]
w hile(ci n.g et()!='/n');
^~
有没有人能帮我看下问题出在哪了?任意输入几个数,求其最大值与平均值
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-