0% found this document useful (0 votes)
10 views2 pages

Driver

The document contains C++ code for a menu-driven program. It includes functions to show the menu, get a response from the user, and a main function that calls these functions in a loop until the user chooses to quit.

Uploaded by

bb8675269
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Driver

The document contains C++ code for a menu-driven program. It includes functions to show the menu, get a response from the user, and a main function that calls these functions in a loop until the user chooses to quit.

Uploaded by

bb8675269
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include <iostream>

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

#include<cstdlib>
//#include "Miscellaneous.h"

void showMenu();
int getResponse();

int main()
{

int response;

//NOTE: each time you finish writing a function and want to test it,
//uncomment the case within the switch that calls that function.
while ( ( response = getResponse() ) != 5 )
{
switch( response )
{

//case 1: multiplication(); cout<<"\n\n"; break;


//case 2: numberGuess(); cout<<"\n\n"; break;
//case 3: printSquare(); cout<<"\n\n"; break;
//case 4: calculatePayroll(); cout<<"\n\n"; break;
}
system("pause");
}

cout<<"\n\nThank you and have a nice day!\n\n";

return 0;

void showMenu()
{

system("cls");
cout<<"***********************************\n";
cout<<"* Press 1 to do multiplication *\n";
cout<<"* Press 2 to play number guessing *\n";
cout<<"* Press 3 to print a square *\n";
cout<<"* Press 4 to calculate payroll *\n";
cout<<"* Press 5 to Quit *\n";
cout<<"***********************************\n";
cout<<"=====> ";

int getResponse()
{
int response;
showMenu();
cin>> response;

while( response < 1 || response > 5)


{
showMenu();
cin >> response;
}
return response;

You might also like