I inserted the solution but i still get the same problem, I have listed the code to show you my problem (by the way thanks for showing me how to use the code tags).
BEFORE
Code:
#include <iostream>
#include <string>
using namespace std;
int main()
{
// declaration of variables
string name2 = "NONE";
string name = " ";
int num1 = 0;
int num2 = 0;
int answer = 0;
cout << "Enter name: ";
getline(cin, name);
cout <<endl;
while (name != "NONE")
{
cout << "enter 1st number: ";
cin >> num1;
cout << "Enter 2nd number: ";
cin >> num2;
// Processing area of program
answer = num1 + num2;
// Output area of program
cout << "Answer is: " << answer << endl;
cout << endl;
cout << "Enter next name: ";
getline(cin, name);
} //end if
return 0;
}
/*
Enter name: NONE
Press any key to continue
*/
/*Enter name: xxxxx
enter 1st number: 3
Enter 2nd number: 8
Answer is: 11
enter name: enter 1st number _ promts here
*/
AFTER
Code:
#include <iostream>
#include <string>
using namespace std;
int main()
{
// declaration of variables
string name2 = "NONE";
string name = " ";
int num1 = 0;
int num2 = 0;
int answer = 0;
cout << "Enter name: ";
getline(cin, name);
while (name != "NONE")
{
cout << "enter 1st number: ";
cin >> num1;
cout << "Enter 2nd number: ";
cin >> num2;
// Processing area of program
answer = num1 + num2;
// Output area of program
cout << "Answer is: " << answer << endl;
cout << endl;
cout << "Enter next name: ";
getline(cin, name);
cout << endl;
} //end if
return 0;
}
/*
Enter name: xxxxxx
enter 1st number: 21
Enter 2nd number: 21
Answer is: 42
Enter next name:
enter 1st number _ promts here
*/