943,608 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 1087
  • C++ RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Dec 1st, 2008
0

Re: How can I add a loop for this code

I dont know if you already figure it out, but here it is...

.../ your code
int addAnswer = add1 + add2;
int subAnswer = sub1- sub2;
int multiplyAnswer = multiply1 * multiply2;
int divAnswer = div1 / div2;

choice=6; // this is what I added

while (choice!=5) { // the loop
check the program, if you notice everytime the user makes a choice, at the end you terminate the program, what you need to do is to initialize "choice =6" and delete "return 0" for everyoption...

check this out:

../ your code showing the menu
if (choice==1)
{
cout << setw (6) << add1 << endl;
cout << "+ ";
cout << setw (4) << add2 << endl;
cout << "------";
cout << "\n";
cin >> input;
cout << "\n";
if
(input == addAnswer)
cout << "Congratulations\n";
else
cout << "That is incorrect,\nThe correct answer is: " << addAnswer;
cout << "\n";
choice=6;
}

else if (choice==2)
{
cout << setw (6) << sub1 << endl;
cout << "- ";
cout << setw (4) << sub2 << endl;
cout << "------";
cout << "\n";
cin >> input;
cout << "\n";
if
(input == subAnswer)
cout << "Congratulations\n";
else
cout << "That is incorrect,\nThe correct answer is: " << subAnswer;
cout << "\n";
choice=6; }

else if (choice==3)
{
cout << setw (6) << multiply1 << endl;
cout << "* ";
cout << setw (4) << multiply2 << endl;
cout << "------";
cout << "\n";
cin >> input;
cout << "\n";
if
(input == multiplyAnswer)
cout << "Congratulations\n";
else
cout << "That is incorrect,\nThe correct answer is: " << multiplyAnswer;
cout << "\n";
choice=6; }

else if (choice==4)
{
cout << setw (6) << div1 << endl;
cout << "/ ";
cout << setw (4) << div2 << endl;
cout << "------";
cout << "\n";
cin >> input;
cout << "\n";
if
(input == divAnswer)
cout << "Congratulations\n";
else
cout << "That is incorrect,\nThe correct answer is: " << divAnswer;
cout << "\n";
choice=6; }

else if (choice==5)
{cout << "Thanks for playing\n";}

else
{cout << "You can only select options 1-5, run the program again and select a option 1-5\n";}


} // end of while
Reputation Points: 10
Solved Threads: 1
Newbie Poster
UsedToBe is offline Offline
1 posts
since Dec 2008
Dec 1st, 2008
0

Re: How can I add a loop for this code

Click to Expand / Collapse  Quote originally posted by UsedToBe ...
I dont know if you already figure it out, but here it is...

.../ your code
C++ Syntax (Toggle Plain Text)
  1. int addAnswer = add1 + add2;
  2. int subAnswer = sub1- sub2;
  3. int multiplyAnswer = multiply1 * multiply2;
  4. int divAnswer = div1 / div2;
  5.  
  6. choice=6; // this is what I added
  7.  
  8. while (choice!=5) { // the loop
  9. check the program, if you notice everytime the user makes a choice, at the end you terminate the program, what you need to do is to initialize "choice =6" and delete "return 0" for everyoption...
  10.  
  11. check this out:
  12.  
  13. ../ your code showing the menu
  14. if (choice==1)
  15. {
  16. cout << setw (6) << add1 << endl;
  17. cout << "+ ";
  18. cout << setw (4) << add2 << endl;
  19. cout << "------";
  20. cout << "\n";
  21. cin >> input;
  22. cout << "\n";
  23. if
  24. (input == addAnswer)
  25. cout << "Congratulations\n";
  26. else
  27. cout << "That is incorrect,\nThe correct answer is: " << addAnswer;
  28. cout << "\n";
  29. choice=6;
  30. }
  31.  
  32. else if (choice==2)
  33. {
  34. cout << setw (6) << sub1 << endl;
  35. cout << "- ";
  36. cout << setw (4) << sub2 << endl;
  37. cout << "------";
  38. cout << "\n";
  39. cin >> input;
  40. cout << "\n";
  41. if
  42. (input == subAnswer)
  43. cout << "Congratulations\n";
  44. else
  45. cout << "That is incorrect,\nThe correct answer is: " << subAnswer;
  46. cout << "\n";
  47. choice=6; }
  48.  
  49. else if (choice==3)
  50. {
  51. cout << setw (6) << multiply1 << endl;
  52. cout << "* ";
  53. cout << setw (4) << multiply2 << endl;
  54. cout << "------";
  55. cout << "\n";
  56. cin >> input;
  57. cout << "\n";
  58. if
  59. (input == multiplyAnswer)
  60. cout << "Congratulations\n";
  61. else
  62. cout << "That is incorrect,\nThe correct answer is: " << multiplyAnswer;
  63. cout << "\n";
  64. choice=6; }
  65.  
  66. else if (choice==4)
  67. {
  68. cout << setw (6) << div1 << endl;
  69. cout << "/ ";
  70. cout << setw (4) << div2 << endl;
  71. cout << "------";
  72. cout << "\n";
  73. cin >> input;
  74. cout << "\n";
  75. if
  76. (input == divAnswer)
  77. cout << "Congratulations\n";
  78. else
  79. cout << "That is incorrect,\nThe correct answer is: " << divAnswer;
  80. cout << "\n";
  81. choice=6; }
  82.  
  83. else if (choice==5)
  84. {cout << "Thanks for playing\n";}
  85.  
  86. else
  87. {cout << "You can only select options 1-5, run the program again and select a option 1-5\n";}
  88.  
  89.  
  90. } // end of while

Ok I tried to do this and add the choice=6 and deleted the return 0 and nothing.


C++ Syntax (Toggle Plain Text)
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <iomanip>
  4. #include <ctime>
  5.  
  6. using namespace std;
  7.  
  8.  
  9. int main ()
  10.  
  11. {
  12. srand((unsigned)time(0));
  13. int add1, add2, sub1, sub2;
  14. int multiply1, multiply2, div1, div2;
  15. int choice, input;
  16. add1 = (rand()%500)+1, add2 = (rand()%500)+1;
  17. sub1 = (rand()%500)+1, sub2 = (rand()%98)+1;
  18. multiply1 = (rand()%98)+1, multiply2 = (rand()%8)+1;
  19. div1 = (rand()%500)+1, div2 = (rand()%8)+1;
  20. int addAnswer = add1 + add2, subAnswer = sub1- sub2;
  21. int multiplyAnswer = multiply1 * multiply2, divAnswer = div1 / div2;
  22.  
  23.  
  24.  
  25.  
  26. //Display the menu and get the user's choice
  27.  
  28. cout << " Geometry Calculator \n\n";
  29. cout << "1. Addition\n";
  30. cout << "2. Subtraction\n";
  31. cout << "3. Multiplication\n";
  32. cout << "4. Division\n";
  33. cout << "5. Quit\n";
  34. cout << "\n";
  35.  
  36. cout <<"Enter your choice (1-5): ";
  37. cin >> choice;
  38. cout << "\n";
  39.  
  40.  
  41. while (choice!=5)
  42.  
  43. if (choice==1)
  44. {
  45. cout << setw (6) << add1 << "\n";
  46. cout << "+ ";
  47. cout << setw (4) << add2 << "\n";
  48. cout << "------";
  49. cout << "\n";
  50. cin >> input;
  51. cout << "\n";
  52. if
  53. (input == addAnswer)
  54. cout << "Congratulations\n";
  55. else
  56. cout << "That is incorrect,\nThe correct answer is: " << addAnswer;
  57. cout << "\n";
  58. cout << "\n";
  59. choice=6;
  60. }
  61.  
  62. else if (choice==2)
  63. {
  64. cout << setw (6) << sub1 << "\n";
  65. cout << "- ";
  66. cout << setw (4) << sub2 << "\n";
  67. cout << "------";
  68. cout << "\n";
  69. cin >> input;
  70. cout << "\n";
  71. if
  72. (input == subAnswer)
  73. cout << "Congratulations\n";
  74. else
  75. cout << "That is incorrect,\nThe correct answer is: " << subAnswer;
  76. cout << "\n";
  77. cout << "\n";
  78. choice=6; }
  79.  
  80. else if (choice==3)
  81. {
  82. cout << multiply1;
  83. cout << " * ";
  84. cout << multiply2 << "=";
  85. cin >> input;
  86. cout << "\n";
  87. if
  88. (input == multiplyAnswer)
  89. cout << "Congratulations\n";
  90. else
  91. cout << "That is incorrect,\nThe correct answer is: " << multiplyAnswer;
  92. cout << "\n";
  93. cout << "\n";
  94. choice=6; }
  95.  
  96. else if (choice==4)
  97. {
  98. cout << div1;
  99. cout << "/";
  100. cout << div2 << "=";
  101. cin >> input;
  102. cout << "\n";
  103. if
  104. (input == divAnswer)
  105. cout << "Congratulations\n";
  106. else
  107. cout << "That is incorrect,\nThe correct answer is: " << divAnswer;
  108. cout << "\n";
  109. cout << "\n";
  110. choice=6; }
  111.  
  112. else if (choice==5)
  113. {
  114. cout << "Thanks for playing\n";
  115. cout << "\n";
  116. cout << "\n";
  117. }
  118.  
  119.  
  120. else
  121. {cout << "You can only select options 1-5, run the program again and select a option 1-5\n";}
  122.  
  123.  
  124.  
  125. return 0;
  126.  
  127.  
  128. }
Reputation Points: 10
Solved Threads: 0
Light Poster
davids2004 is offline Offline
43 posts
since Nov 2008
Dec 1st, 2008
0

Re: How can I add a loop for this code

Ok I got the loop to work now why am I not generating random numbers each time. It just displays the same numbers each time a selection is picked. It will display random numbers when I re run the program but now if I run it again with the loop.

C++ Syntax (Toggle Plain Text)
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <iomanip>
  4. #include <ctime>
  5.  
  6. using namespace std;
  7.  
  8.  
  9. int main ()
  10. {
  11. srand((unsigned)time(0));
  12. int add1, add2, sub1, sub2;
  13. int multiply1, multiply2, div1, div2;
  14. int choice, input;
  15. add1 = (rand()%500)+1, add2 = (rand()%500)+1;
  16. sub1 = (rand()%500)+1, sub2 = (rand()%98)+1;
  17. multiply1 = (rand()%98)+1, multiply2 = (rand()%8)+1;
  18. div1 = (rand()%500)+1, div2 = (rand()%8)+1;
  19. int addAnswer = add1 + add2, subAnswer = sub1- sub2;
  20. int multiplyAnswer = multiply1 * multiply2, divAnswer = div1 / div2;
  21.  
  22.  
  23. do
  24. { //Display the menu and get the user's choice
  25.  
  26. cout << " Math Tutor \n\n";
  27. cout << "1. Addition\n";
  28. cout << "2. Subtraction\n";
  29. cout << "3. Multiplication\n";
  30. cout << "4. Division\n";
  31. cout << "5. Quit\n";
  32. cout << "\n";
  33.  
  34. cout <<"Enter your choice (1-5): ";
  35. cin >> choice;
  36. cout << "\n";
  37.  
  38. //Validate the menu selection
  39. while (choice < 1 || choice > 5)
  40. {
  41. cout << "That is not a valid option\n";
  42. cout <<"Enter your choice (1-5): ";
  43. cin >> choice;
  44. cout << "\n";
  45. }
  46.  
  47.  
  48.  
  49.  
  50. if (choice==1)
  51. {
  52. cout << setw (6) << add1 << "\n";
  53. cout << "+ ";
  54. cout << setw (4) << add2 << "\n";
  55. cout << "------";
  56. cout << "\n";
  57. cin >> input;
  58. cout << "\n";
  59. if
  60. (input == addAnswer)
  61. cout << "Congratulations\n";
  62. else
  63. cout << "That is incorrect,\nThe correct answer is: " << addAnswer;
  64. cout << "\n";
  65. cout << "\n";
  66. }
  67.  
  68. else if (choice==2)
  69. {
  70. cout << setw (6) << sub1 << "\n";
  71. cout << "- ";
  72. cout << setw (4) << sub2 << "\n";
  73. cout << "------";
  74. cout << "\n";
  75. cin >> input;
  76. cout << "\n";
  77. if
  78. (input == subAnswer)
  79. cout << "Congratulations\n";
  80. else
  81. cout << "That is incorrect,\nThe correct answer is: " << subAnswer;
  82. cout << "\n";
  83. cout << "\n";
  84. }
  85.  
  86. else if (choice==3)
  87. {
  88. cout << multiply1;
  89. cout << " * ";
  90. cout << multiply2 << "=";
  91. cin >> input;
  92. cout << "\n";
  93. if
  94. (input == multiplyAnswer)
  95. cout << "Congratulations\n";
  96. else
  97. cout << "That is incorrect,\nThe correct answer is: " << multiplyAnswer;
  98. cout << "\n";
  99. cout << "\n";
  100. }
  101.  
  102. else if (choice==4)
  103. {
  104. cout << div1;
  105. cout << "/";
  106. cout << div2 << "=";
  107. cin >> input;
  108. cout << "\n";
  109. if
  110. (input == divAnswer)
  111. cout << "Congratulations\n";
  112. else
  113. cout << "That is incorrect,\nThe correct answer is: " << divAnswer;
  114. cout << "\n";
  115. cout << "\n";
  116. }
  117.  
  118. else if (choice==5)
  119. {
  120. cout << "Thanks for playing\n";
  121. cout << "\n";
  122. cout << "\n";
  123. }
  124.  
  125. } while (choice !=5);
  126.  
  127. return 0;
  128.  
  129.  
  130. }
Last edited by davids2004; Dec 1st, 2008 at 9:56 pm.
Reputation Points: 10
Solved Threads: 0
Light Poster
davids2004 is offline Offline
43 posts
since Nov 2008
Dec 1st, 2008
0

Re: How can I add a loop for this code

Short answer:

Move the do { from line 23/24 in front of the random stuff starting on line 15.

Longer answer:
If you were to break each problem type out into a function, you could call it from the if (choice == stuff. The function could then generate the random values for the problem.

This second method would have the added advantage of having everything about the problem all in one place. (The random parameters, the display, the input and the validation.) Also, your code wouldn't be bothering to generate random problems that will never be used.

Sample add method:
c++ Syntax (Toggle Plain Text)
  1. void add()
  2. {
  3. int add1 = (rand()%500)+1;
  4. int add2 = (rand()%500)+1;
  5. int addAnswer = add1 + add2;
  6.  
  7. cout << setw (6) << add1 << "\n";
  8. cout << "+ ";
  9. cout << setw (4) << add2 << "\n";
  10. cout << "------";
  11. cout << "\n";
  12. cin >> input;
  13. cout << "\n";
  14. if (input == addAnswer)
  15. cout << "Congratulations\n";
  16. else
  17. cout << "That is incorrect,\nThe correct answer is: " << addAnswer;
  18. cout << "\n";
  19. cout << "\n";
  20. }
Reputation Points: 344
Solved Threads: 116
Practically a Master Poster
Murtan is offline Offline
670 posts
since May 2008
Dec 2nd, 2008
0

Re: How can I add a loop for this code

Click to Expand / Collapse  Quote originally posted by Murtan ...
Short answer:

Move the do { from line 23/24 in front of the random stuff starting on line 15.

Longer answer:
If you were to break each problem type out into a function, you could call it from the if (choice == stuff. The function could then generate the random values for the problem.

This second method would have the added advantage of having everything about the problem all in one place. (The random parameters, the display, the input and the validation.) Also, your code wouldn't be bothering to generate random problems that will never be used.

Sample add method:
c++ Syntax (Toggle Plain Text)
  1. void add()
  2. {
  3. int add1 = (rand()%500)+1;
  4. int add2 = (rand()%500)+1;
  5. int addAnswer = add1 + add2;
  6.  
  7. cout << setw (6) << add1 << "\n";
  8. cout << "+ ";
  9. cout << setw (4) << add2 << "\n";
  10. cout << "------";
  11. cout << "\n";
  12. cin >> input;
  13. cout << "\n";
  14. if (input == addAnswer)
  15. cout << "Congratulations\n";
  16. else
  17. cout << "That is incorrect,\nThe correct answer is: " << addAnswer;
  18. cout << "\n";
  19. cout << "\n";
  20. }
So would I need to create a function for each problem?
Reputation Points: 10
Solved Threads: 0
Light Poster
davids2004 is offline Offline
43 posts
since Nov 2008
Dec 2nd, 2008
0

Re: How can I add a loop for this code

Murtan,

I used your short answer method as we are just starting to learn about functions.

Thanks and problem solved

C++ Syntax (Toggle Plain Text)
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <iomanip>
  4. #include <ctime>
  5.  
  6. using namespace std;
  7.  
  8.  
  9. int main ()
  10. {
  11. srand((unsigned)time(0));
  12. int add1, add2, sub1, sub2;
  13. int multiply1, multiply2, div1, div2;
  14. int choice, input;
  15. do {add1 = (rand()%500)+1, add2 = (rand()%500)+1;
  16. sub1 = (rand()%500)+1, sub2 = (rand()%98)+1;
  17. multiply1 = (rand()%98)+1, multiply2 = (rand()%8)+1;
  18. div1 = (rand()%500)+1, div2 = (rand()%8)+1;
  19. int addAnswer = add1 + add2, subAnswer = sub1- sub2;
  20. int multiplyAnswer = multiply1 * multiply2, divAnswer = div1 / div2;
  21.  
  22.  
  23. //Display the menu and get the user's choice
  24.  
  25. cout << " Math Tutor \n\n";
  26. cout << "1. Addition\n";
  27. cout << "2. Subtraction\n";
  28. cout << "3. Multiplication\n";
  29. cout << "4. Division\n";
  30. cout << "5. Quit\n";
  31. cout << "\n";
  32.  
  33. cout <<"Enter your choice (1-5): ";
  34. cin >> choice;
  35. cout << "\n";
  36.  
  37. //Validate the menu selection
  38. while (choice < 1 || choice > 5)
  39. {
  40. cout << "That is not a valid option\n";
  41. cout <<"Enter your choice (1-5): ";
  42. cin >> choice;
  43. cout << "\n";
  44. }
  45.  
  46. if (choice==1)
  47. {
  48. cout << setw (6) << add1 << "\n";
  49. cout << "+ ";
  50. cout << setw (4) << add2 << "\n";
  51. cout << "------";
  52. cout << "\n";
  53. cin >> input;
  54. cout << "\n";
  55. if
  56. (input == addAnswer)
  57. cout << "Congratulations\n";
  58. else
  59. cout << "That is incorrect,\nThe correct answer is: " << addAnswer;
  60. cout << "\n";
  61. cout << "\n";
  62. }
  63.  
  64. else if (choice==2)
  65. {
  66. cout << setw (6) << sub1 << "\n";
  67. cout << "- ";
  68. cout << setw (4) << sub2 << "\n";
  69. cout << "------";
  70. cout << "\n";
  71. cin >> input;
  72. cout << "\n";
  73. if
  74. (input == subAnswer)
  75. cout << "Congratulations\n";
  76. else
  77. cout << "That is incorrect,\nThe correct answer is: " << subAnswer;
  78. cout << "\n";
  79. cout << "\n";
  80. }
  81.  
  82. else if (choice==3)
  83. {
  84. cout << multiply1;
  85. cout << " * ";
  86. cout << multiply2 << "=";
  87. cin >> input;
  88. cout << "\n";
  89. if
  90. (input == multiplyAnswer)
  91. cout << "Congratulations\n";
  92. else
  93. cout << "That is incorrect,\nThe correct answer is: " << multiplyAnswer;
  94. cout << "\n";
  95. cout << "\n";
  96. }
  97.  
  98. else if (choice==4)
  99. {
  100. cout << div1;
  101. cout << "/";
  102. cout << div2 << "=";
  103. cin >> input;
  104. cout << "\n";
  105. if
  106. (input == divAnswer)
  107. cout << "Congratulations\n";
  108. else
  109. cout << "That is incorrect,\nThe correct answer is: " << divAnswer;
  110. cout << "\n";
  111. cout << "\n";
  112. }
  113.  
  114. else if (choice==5)
  115. {
  116. cout << "Thanks for playing\n";
  117. cout << "\n";
  118. cout << "\n";
  119. }
  120.  
  121. } while (choice !=5);
  122.  
  123. return 0;
  124.  
  125.  
  126. }
Reputation Points: 10
Solved Threads: 0
Light Poster
davids2004 is offline Offline
43 posts
since Nov 2008
Dec 2nd, 2008
0

Re: How can I add a loop for this code

Ok fixed it so it would display the menu again if you do not select a valid option

C++ Syntax (Toggle Plain Text)
  1.  
  2. #include <iostream>
  3. #include <cstdlib>
  4. #include <iomanip>
  5. #include <ctime>
  6.  
  7. using namespace std;
  8.  
  9.  
  10. int main ()
  11. {
  12. srand((unsigned)time(0));
  13. int add1, add2, sub1, sub2;
  14. int multiply1, multiply2, div1, div2;
  15. int choice, input;
  16. do {add1 = (rand()%500)+1, add2 = (rand()%500)+1;
  17. sub1 = (rand()%500)+1, sub2 = (rand()%98)+1;
  18. multiply1 = (rand()%98)+1, multiply2 = (rand()%8)+1;
  19. div1 = (rand()%500)+1, div2 = (rand()%8)+1;
  20. int addAnswer = add1 + add2, subAnswer = sub1- sub2;
  21. int multiplyAnswer = multiply1 * multiply2, divAnswer = div1 / div2;
  22.  
  23.  
  24. //Display the menu and get the user's choice
  25.  
  26. cout << " Math Tutor \n\n";
  27. cout << "1. Addition\n";
  28. cout << "2. Subtraction\n";
  29. cout << "3. Multiplication\n";
  30. cout << "4. Division\n";
  31. cout << "5. Quit\n";
  32. cout << "\n";
  33.  
  34. cout <<"Enter your choice (1-5): ";
  35. cin >> choice;
  36. cout << "\n";
  37.  
  38. //Validate the menu selection
  39. while (choice < 1 || choice > 5)
  40. {
  41. cout << "That is not a valid option\n";
  42. cout <<"Please select again\n\n ";
  43. cout << " Math Tutor \n\n";
  44. cout << "1. Addition\n";
  45. cout << "2. Subtraction\n";
  46. cout << "3. Multiplication\n";
  47. cout << "4. Division\n";
  48. cout << "5. Quit\n";
  49. cout << "\n";
  50.  
  51. cout <<"Enter your choice (1-5): ";
  52. cin >> choice;
  53. cout << "\n";
  54. }
  55.  
  56. if (choice==1)
  57. {
  58. cout << setw (6) << add1 << "\n";
  59. cout << "+ ";
  60. cout << setw (4) << add2 << "\n";
  61. cout << "------";
  62. cout << "\n";
  63. cin >> input;
  64. cout << "\n";
  65. if
  66. (input == addAnswer)
  67. cout << "Congratulations\n";
  68. else
  69. cout << "That is incorrect,\nThe correct answer is: " << addAnswer;
  70. cout << "\n";
  71. cout << "\n";
  72. }
  73.  
  74. else if (choice==2)
  75. {
  76. cout << setw (6) << sub1 << "\n";
  77. cout << "- ";
  78. cout << setw (4) << sub2 << "\n";
  79. cout << "------";
  80. cout << "\n";
  81. cin >> input;
  82. cout << "\n";
  83. if
  84. (input == subAnswer)
  85. cout << "Congratulations\n";
  86. else
  87. cout << "That is incorrect,\nThe correct answer is: " << subAnswer;
  88. cout << "\n";
  89. cout << "\n";
  90. }
  91.  
  92. else if (choice==3)
  93. {
  94. cout << multiply1;
  95. cout << " * ";
  96. cout << multiply2 << "=";
  97. cin >> input;
  98. cout << "\n";
  99. if
  100. (input == multiplyAnswer)
  101. cout << "Congratulations\n";
  102. else
  103. cout << "That is incorrect,\nThe correct answer is: " << multiplyAnswer;
  104. cout << "\n";
  105. cout << "\n";
  106. }
  107.  
  108. else if (choice==4)
  109. {
  110. cout << div1;
  111. cout << "/";
  112. cout << div2 << "=";
  113. cin >> input;
  114. cout << "\n";
  115. if
  116. (input == divAnswer)
  117. cout << "Congratulations\n";
  118. else
  119. cout << "That is incorrect,\nThe correct answer is: " << divAnswer;
  120. cout << "\n";
  121. cout << "\n";
  122. }
  123.  
  124. else if (choice==5)
  125. {
  126. cout << "Thanks for playing\n";
  127. cout << "\n";
  128. cout << "\n";
  129. }
  130.  
  131. } while (choice !=5);
  132.  
  133. return 0;
  134.  
  135.  
  136. }
Reputation Points: 10
Solved Threads: 0
Light Poster
davids2004 is offline Offline
43 posts
since Nov 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Function 'initgraph' should have a prototype
Next Thread in C++ Forum Timeline: Program on strings - Can anyone solve this program?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC