I have been trying to get my program to ask the user if the want to run the program again before exiting. I have been using he following while loop. It isn't working, any suggestions.

char again;
again = 'Y';
while (again == 'Y','y')
{

//
// program
//

cout << "Enter the number 1 if you wish to run the program again!!!";
cin >> again;
}

You can't use commas that way. You want to write again == 'Y' || again == 'y' .

The comma operator behaves in the following way. The left side of the comma operator is evaluated first, and then the right side is evaluated, and the expression's return value will be the right side. For example, the expression 2, 3 will evaluate to 3 .

You should basically never use the comma operator for this purpose, but there are some interesting idioms found in some libraries where the operator is overloaded to have a different meaning.

You have a mistake by asking user:

cout << "Enter the number 1 if you wish to run the program again!!!";

Better way is to write:

cout << "Enter the Y or y if you wish to run the program again!!!";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.