This code is meant to keep prompting for user input (integers), and when 0 is pressed it is meant to view the product of all the entered numbers apart from 0.
It works fine, but when I hit 0 to view the product, it shows 0.
Here's the code:
Can anyone see the problem here, and how I can fix it?
Thanks
:P
It works fine, but when I hit 0 to view the product, it shows 0.
Here's the code:
Code:
if (a == 10)
{
int l;
int m;
cout<< "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \n \n";
cout << "Activated multiplying function... \n \n";
while (1){
cout << "Enter one number to multiply ( 0 to find total ): \n";
cin >> l;
m = m*l;
if (l == 0)
{
cout << "PRODUCT:" << endl;
cout << m << endl;
cout << endl;
cout<< "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \n \n";
break;
}
}
}
Thanks
:P
Comment