I wanted the user to type Y if they wanted another multiplication table, and n if they wanted the program to quit. So how can I implement that? I thought the entries of the characters Y or N would need the using std::string? So confused! Jes On Jul 18, 2010, at 4:18 AM, Martin Slack wrote: > Have a look at the while condition on the last line before the return > statement. What do you expect to have been typed in answer to the preceding > question? > > Martin > > > ----- Original Message ----- From: "Jes" <theeternalkid@xxxxxxxxx> > To: <programmingblind@xxxxxxxxxxxxx> > Sent: Sunday, July 18, 2010 8:18 AM > Subject: Logic errors in my program? > > > Hi all, > > After working on this program for four hours total, I finally got all the > syntax errors out and the program runs. > It's a simple program that multiplies a number from 1 to 10, then displays > the results. It asks the user to enter the number they want multiplied, then > it does the multiples. After it displays the results to the screen, it is > supposed to ask the user if they want another multiplication table displayed. > If the user presses y, it should start all over again, and if they press n, > the program should exit. > However, every time I run the program, it exits on me no matter what answer I > give it. If I answer y, it exits. Can somebody take a look at this code and > tell me what I'm doing wrong? > Thanks for any help. > Jes > ***code** > //Ch8lab2.cpp > //Displays one or more multiplication tables > //Created/revised by Jes Smith on July 18, 2010 > #include <iostream> > using std::cout; > using std::cin; > using std::endl; > int main() > { > //Declare variables > char anotherTable = 0; > int multiplicand = 0; > int product = 0; > do > { > //get the multiplicand > cout << "Enter the multiplicand: "; > cin >> multiplicand; > //display the multiplication table > for (int multiplier = 1; multiplier <= 10; multiplier += 1) > { > product = multiplicand * multiplier; > cout << product << endl; > } //end for > cout << "Display another multiplication table? (Y/N) "; > cin >> anotherTable; > } > while (toupper(anotherTable) == 0); > return 0; > > } //end of main function > > > > __________ > View the list's information and change your settings at > //www.freelists.org/list/programmingblind > __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind