Im a beginner at c++ and this program seem to be easy. Im tying to get this program to multiply numbers as there put in by the user and display the answer, but if the user inputs to consecitive negative numbers the program has to stop. What concept can I use to make the program multiply and stop when using consecitve negative numbers. Oh and my break keeps being illegal.
Thank you
Im really confused!!
#include "stdafx.h"
# include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int product;
int b;
int i;
i=0;
float sum;
sum=1;
{
while (b>=0)
i++;
//enter values
cout<<"Enter a number\n";
cin>> b ;
cin>> product;
sum=product*b;
}
cout<<"Nunbers multiplied together equals "<<sum<<endl;
cin>>b;
if(i<0){
i++;
cout<<"One negative number entered\n";
if(i<0){
break;
}
cout<<"Second negative number entered, program stop\n";
}
return 0;
}