Question: Creating new program by C ++ based on given specific structure, thank you very much #include stdafx.h # include int maximum(int firstN, float secondN, int

Creating new program by C ++ based on given specific structure, thank you very much

Creating new program by C ++ based on given specific structure, thank

#include "stdafx.h"

# include

int maximum(int firstN, float secondN, int thirdN);

void printMenu();

void programDriver();

int main()

{

//int x=1; // integer number;

//float y=1.02;

//char z = 'a'; // char is character

//==================

programDriver();

}

int maximum(int firstN, float secondN, int thirdN)

{

int max;

max = thirdN;

printf("max is now: %d ", max);

if (firstN > max)

{

max = firstN;

printf("max is now: %d ", max);

}

if (secondN >max)

{

max = secondN;

printf("max is now: %d ", max);

}

return max;

}

void printMenu()

{

printf("please select an option by inputing a number ");

printf("1, option1 ");

printf("2, option2 ");

printf("3, option3 ");

printf("4, option4 ");

printf("5, Exist ");

}

void programDriver()

{

int x = 5;

float y = 9.4;

int z = 3;

//maximum (x,y,z);

while (1)

{

printMenu();

scanf_s("%d", &x);

if (x == 1)

{

// do sth

}

else if (x == 2)

{

// do sth

}

else if (x == 5)

{

exit(0);

}

}

}

Create a menu that offers 4 different print out options. The program should ask the user to choose an option and will print a message based on that input. Each options logic should be handled in another function(they can all be handled by the same function, but a call must be made to that function "after the selection is made). The program should continue asking the user for input after the option is finished until the user selects 5. That will exit the program. At least one function should accept arguments(parameters) and print there value to the user. The main function should contain a single function call and nothing else. An example of a menu would be: 1. Print out You chose option 1 2. Print out You chose option 2. 3. Print out You chose option 3. 4. Print out You chose option 4. 5. Exit stdlib.h contains a function for exiting a program. exit(1); /use this line to exit the program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!