Multiplication Table Code Modification

Page 1 of 1

1 Replies - 3099 Views - Last Post: 21 April 2009 - 02:11 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=100811&amp;s=af3b837754b731b9817657c93aee7129&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

#1 zipperson

Reputation: 0
• Posts: 1
• Joined: 23-March 09

Multiplication Table Code Modification

Posted 21 April 2009 - 01:32 PM

I need to modify this multiplication table program from the current Do While into a While and am not sure how to go about making it work.

Heres' the code::::::

``` #include <iostream>

using std::cout;
using std::cin;
using std::endl;

int main()
{
//declare variable
char anotherTable = ' ';
int multiplicand  = 0;
int product	   = 0;

do
{
//get the multiplicand
cout << "Enter the multiplicand: ";
cin  >> multiplicand;

//display the multiplicand table
for (int multiplier = 1; multiplier < 10; multiplier += 1)
{
product = multiplicand * multiplier;
cout << multiplicand << " * " << multiplier
<< " = " << product << endl;
}   //end for

cout << endl;
cout << "Display another multiplication table? (Y/N) ";
cin >> anotherTable;
} while (toupper (anotherTable) == 'Y');

return 0;
}   //end of main function
```

Is This A Good Question/Topic? 0

Replies To: Multiplication Table Code Modification

#2 BlakeJustBlake

• D.I.C Regular

Reputation: 26
• Posts: 441
• Joined: 15-February 09

Re: Multiplication Table Code Modification

Posted 21 April 2009 - 02:11 PM

Delete the do and the semicolon after the while statement. Move the while statement to where the do statement used to be. Done.