发信人: lys(不败), 信区: C
标 题: 小白求助
发信站: 饮水思源 (2014年04月23日21:01:16 星期三)
#include <iostream>
int main()
{
int num, count(+)=0, count(-)=0;
double sum=0.0, average+0.0;
cout<<"please input non 0 number and end this procure by inputting 0"<<endl;
cin>>num;
while(num!=0)
{
if(num>0)
{count(+)++;
else
count(-)++;
}
}
if(count(+)+count(-)=0)
{
cout<<"please input non 0 number to start this program"<<endl;
else
sum=sum+num;
average=sum/(count(+)+count(-);
cout<<"you have input"<<count(+)<<"positive number and"<<count(-)<<"negative
number"<<endl;
count<<"the summarization of all the numbers is"<<sum/n<<"and the average is
"<<average<<endl;
}
}
编译的时候,最后的那个“}”报错,是什么原因啊?
--
※ 来源:·饮水思源 bbs.sjtu.edu.cn·[FROM: 58.196.152.97]
标 题: 小白求助
发信站: 饮水思源 (2014年04月23日21:01:16 星期三)
#include <iostream>
int main()
{
int num, count(+)=0, count(-)=0;
double sum=0.0, average+0.0;
cout<<"please input non 0 number and end this procure by inputting 0"<<endl;
cin>>num;
while(num!=0)
{
if(num>0)
{count(+)++;
else
count(-)++;
}
}
if(count(+)+count(-)=0)
{
cout<<"please input non 0 number to start this program"<<endl;
else
sum=sum+num;
average=sum/(count(+)+count(-);
cout<<"you have input"<<count(+)<<"positive number and"<<count(-)<<"negative
number"<<endl;
count<<"the summarization of all the numbers is"<<sum/n<<"and the average is
"<<average<<endl;
}
}
编译的时候,最后的那个“}”报错,是什么原因啊?
--
※ 来源:·饮水思源 bbs.sjtu.edu.cn·[FROM: 58.196.152.97]
No comments:
Post a Comment