Answer to Question #233120 in C++ for haha

Question #233120

Construct function prototypes that match the following descriptions:

i) ab () takes no arguments and has no return value.

ii) start() takes an int argument and returns a float.

iii) mk() takes two type double arguments and returns a double.

iv) func6() returns an int and takes three arguments. The first and third arguments are of

type double. The second argument is of type int.

v) func4() returns a char and takes one argument that is also of type char.


1
Expert's answer
2021-09-04T10:55:23-0400
#include <iostream>
#include <string.h>
using namespace std;
//Prototype
//ab() takes no arguments and has no return value
void ab();
//start() takes an int argument and returns a float.
float start(int );
//mk() takes two type double arguments and returns a double
double mk(double, double);
/*
func6() returns an int and takes three arguments. The first and third arguments are of
type double. The second argument is of type int.
*/
int func6(double, int, double);
//func4() returns a char and takes one argument that is also of type char.
char func4(char);
void Print(const char* s)
{
	cout << s << endl;
}
bool test()
{
	cout << "Menu\n";
	cout << "1 -Show ab() prototypes\n";
	cout << "2 -Show start() prototypes\n";
	cout << "3 -Show mk() prototypes\n";
	cout << "4 -Show func6() prototypes\n";
	cout << "5 -Show func4() prototypes\n";
	cout << "6 -Exit programm\n";
	int cmd;
	cin >> cmd;
	switch (cmd)
	{
	case 1:
	{
		Print("void ab();");
		break;
	}
	case 2:
	{
		Print("float start(int );");
		break;
	}
	case 3:
	{
		Print("double mk(double, double);");
		break;
	}
	case 4:
	{
		Print("int func6(double, int, double);");
		break;
	}
	case 5:
	{
		Print("char func4(char);");
		break;
	}
	case 6:
		return false;
	}
	return true;
}
int main()
{
	while (test())
	{
		cout << "\n>>>>>>>>>>>>>>>>>>>>NEXT>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n";
	}
	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS