Re: Where did i go wrong??
That code didn't compile. Fixing the compile errors, this is what your code looks like properly formatted. Logic errors should be obvious.
Code:
#include<iostream>
using namespace std;
int main()
{
int numbers;
int counter1=0;
int counter2=0;
cout<<"enter numbers, 0 to stop the program and display the result"<<endl;
cin>>numbers;
while(numbers!=0)
{
if(numbers < 0)
{
counter1 = counter1+1;
}
else
counter2=counter2+1;
if(numbers ==0 )
{
cout<<"you have entered "<<counter1<<" Negative numbers!"<<endl;
}
return 0;
system("pause");
}
}