Question: C++ simple code problem: I am trying to write a small program that finds the product of two numbers with a do-while. int nmbr1, nmbr2;

C++ simple code problem:

I am trying to write a small program that finds the product of two numbers with a do-while.

int nmbr1, nmbr2;

int product = 1;

do {

cout << "Enter a number: " << endl;

cin >> nmbr1 >> nmbr2;

product = nmbr1 ^ nmbr2;

} while (nmbr1 != 0);

cout << "Total sum is: " << product

<< endl;

system("Pause");

return 0;

============

Is the problem with the while statement? It keeps returning 0 and the input nature in the command prompt is strange as well.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!