do-while loop

Hi all,
I'm trying to get the do while loop here to repeat but I can't get it to and I can't figure it the problem, it just ends after the last cout.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  double sum;
	double num1, num2;
	char again;
	char Y;
	char y;

	cout << "Enter two numbers and I shall add them:\n";
	cin >> num1 >> num2;
	

	sum = num1 + num2;
	cout << "The sum is " << sum << endl;
	
	do{
	cout << "Would you like to perform this operation again?(Y/N)" << endl;
	cin >> again;

	} while ((again =='Y') && (again == 'y') );
"again" is a char, it can not be equal to "Y" AND "y" at the same time.
Try replacing the "&&" by "||" to make it an OR statement.
Agree with Nico. Also, if you want to repeat the whole program try moving line 14 below 5 or 7, depending on preference.
I replace the && into || which made it repeated and then I did have to move the do{ to make it repeat the whole program, thank you guys cheers.
Topic archived. No new replies allowed.