The following program is designed to input two numbers and output their sum. It asks the user if he/she would like to run the program. If the answer isY ory, it prompts the user to enter two numbers. After adding the numbers and displaying the results, it again asks the user if he/she would like to add more numbers. However, the program fails to do so. Correct the program so that it works properly.
#include
using namespace std;
int main()
{
char response;
double num1;
double num2;
cout < "this="" program="" adds="" two="" numbers."=""><>
cout < "would="" you="" like="" to="" run="" the="" program:="" (y/y)="">
cin >> response;
cout <>
cout < fixed="">< showpoint=""><>
while (response == 'Y' && response == 'y')
cout < "enter="" two="" numbers:="">
cin >> num1 >> num2;
cout < num1="">< "="" +="" "="">< num2="">< "=" << (num1 – num2)
<< endl;
cout << " would="" you="" like="" to="" add="" again:="" (y/y)="">
}
return 0;
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here