Hi all! THis is the program I am supposed to write:
Modify the program so it displays a menu allowing the user to select an addition, subtraction, multiplication, or division problem. The final selection on the menu should let the user quit the program. After the user has finished the math problem, the program should display the menu again. This process is repeated until the user chooses to quit the program.

Input Validation: If the user selects an item not on the menu, display an error message and display the menu again. Additional notes to pc4:

  • Do not implement the subtraction, multiplication, or division. Instead, provide a message to the effect that the module is not yet ready.
  • Use a switch statement to process menu choices.
  • Use a 'do while' loop, as shown below.
  • Here is pseudocode of what should go in the do loop for this exercise:
  • do { 1. addition
  • 2. subtraction
  • 3. etc
  • 5. quit Which would you like?
  • switch (choice)
  • case 1: the whole program you already wrote
  • case 2: not available etc.
  • case 5: Thank you and goodbye!
  • default: got to be kidding, try again! }
  • while( choice != 5 ); 'do while' loops and 'switch' work great for menus. The screen capture for this assignment should demonstrate a 'Not Available' and 'Exit' choice

The problem I am having is that it won't compile and I"m not sure why. This is the code I have so far does anyone know what I'm doing wrong?

#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
    int choice; // menu choice
    
    cout << "This program written by Katy Pedro cs102 Online." << endl;
    
    do
    {
        cout << " MENU " << endl;
        cout << " 1. Addition\n";
        cout << " 2. Subtraction\n";
        cout << " 3. Multiplication\n";
        cout << " 4. Division\n";
        cout << " 5. Quit the program\n";
        cout << "_____________________\n";
        
        
        while (choice < 1 || choice > 5)
        {
              cout << "Enter your selection: ";
              cin >> choice;
              }
              if (choice !=5)
        {
              cout << "I'm sorry but that is not available!" << endl;
        
        switch (choice)
        {
               case 1: cout << "Please make a different choice, this program is not available.\n";
                    break;
               case 2: cout << "Please make a different choice, this program is not available.\n";
                    break;
               case 3: cout << "Please make a different choice, this program is not available.\n";
                    break;
               case 4: cout << "Please make a different choice, this program is not available.\n";
                    break;
               case 5: "Thank you for making the right choice! GOODBYE for now!\n";
                    break;
               default: cout << "Are you serious? Try Again!!!\n";
               }
              
    system("PAUSE");
    return 0;

}

THanks in advance any help is greatly appreciated!!!:cheesy:

if (choice !=5)

        {

              cout << "I'm sorry but that is not available!" << endl;

You forgot to add a closing brace.

system("PAUSE");

    return 0;

You never ended the do loop; do loops require a closing brace and a while statement to follow.

And lastly, you never ended the main function! A closing brace is all that's needed.

Here's something that you might find useful. Because the description of the problem isnt really the clearest it could be, I made this little program up to help you understand what should happen. Its using a functino called DoMenu which displays the menu and gets input from there.

#include <iostream>

using namespace std;

int DoMenu();

int main()
{
    int choice;
    do
    {
        choice = DoMenu();

        switch (choice)
        {
            case 1: cout << "addition\n";        break;
            case 2: cout << "subtraction\n";    break;
            case 3: cout << "multiplication\n"; break;
            case 4: cout << "division\n";        break;
            case 5: cout << "quit\n";            break;
            default : cout << "Error input\n";
        }

    } while (choice != 5);

    return 0;
}

int DoMenu()
{
    int MenuChoice;
        cout << " MENU\n";
        cout << " 1. Addition\n";
        cout << " 2. Subtraction\n";
        cout << " 3. Multiplication\n";
        cout << " 4. Division\n";
        cout << " 5. Quit the program\n";
        cout << "_____________________\n";
    cin >> MenuChoice;
    return MenuChoice;
}

Create an application that will input any integer values and display it in reverse using looping in visual basic 2008. please answer thanks^^

A. You are responding to a three year old post
B. You are hijacking that thread with a new problem
C. You are asking for a solution to a problem you have not attempted to solve on your own
D. This is a C++ forum, you're asking for a VB program

Read the sticky threads at the beginning of the forums, and chose the correct forum for your problem. You might then get some help.

This article has been dead for over six months. Start a new discussion instead.