找了好久。。。
#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;
}
JustWannaHugU
慕仙1118221
相关分类