找了好久。。。#include "stdafx.h"#include <iostream>using namespace std;int main(){ int a=0,b=0,n; cout<<"Please enter some integers (enter 0 to quit):"<<endl; cin>>n; while(n!=0) { if(n>0) { a++; } else{ b++; } cin>>n; } cout<<"Count of positive integers: "<<a<<endl; cout<<"Count of negative integers: "<<b<<endl; return 0;}
2 回答
已采纳
JustWannaHugU
TA贡献452条经验 获得超796个赞
//#include "stdafx.h" 注释了这一行就行了
#include <iostream>
using namespace std;
int main()
{
int a=0,b=0,n;
cout<<"Please enter some integers (enter 0 to quit):"<<endl;
cin>>n;
while(n!=0)
{
if(n>0) {
a++;
}
else{
b++;
}
cin>>n;
}
cout<<"Count of positive integers: "<<a<<endl;
cout<<"Count of negative integers: "<<b<<endl;
return 0;
}并没有什么错啊!
- 2 回答
- 0 关注
- 1460 浏览
添加回答
举报
0/150
提交
取消
