Hello guys, this is a practice problem I have received and I\'m having some trou
ID: 641331 • Letter: H
Question
Hello guys, this is a practice problem I have received and I'm having some trouble understaing where and what to place for the functions of this probelm. The only instructions are to "Place your function definitions in the labeled areas in the driver program ." Any guidance at all would really be benefictial to me. I'm also having some trouble understanding the DO while, and while loop variables any links for help with that would be very much appreciate as well! #include <iostream> using namespace std; const int NUMPMT = 360; void displaySplash(); /* This is a welcome screen that displays the name of the program the programmer's name and date of production */ //Function Protoypes void functionA(); int functionB(int, int, int); char functionC(double); bool functionF(int, int, int); bool functionG(int); bool functionH(char); void functionI(int, int, int); int main(){ cout << "Function A "; functionA(); cout << "Function B: " << functionB(3, 4, 5); cout << "Function C: " << functionC(-78.23); cout << " Function C: " << functionC(987.889); cout << " Function F: " << functionF(4, 6, 9); cout << " Function F: " << functionF(6, 4, 9); cout << " Function G: " << functionG(92); cout << " Function G: " << functionG(91); cout << " Function H: " << functionH('K'); cout << " Function H: " << functionH('8'); cout << "Function I "; functionI(9, 12, 6); return 0; } } void functionA(){ } int functionB(int, int, int){ } char functionC(double){ } bool functionF(int, int, int){ } bool functionG(int){ } bool functionH(char){ } void functionI(int, int, int){ }
Explanation / Answer
Progam should be in the following manner:
#include <iostream>
const int NUMPMT = 360;
void displaySplash();
/* This is a welcome screen that displays the name of the program
the programmer's name and date of production
*/
//Function Protoypes
void functionA();
int functionB(int, int, int);
char functionC(double);
bool functionF(int, int, int);
bool functionG(int);
bool functionH(char);
void functionI(int, int, int);
using namespace std;
int main()
{
displaySplash();
cout << "Function A ";
functionA();
cout << "Function B: " << functionB(3, 4, 5);
cout << "Function C: " << functionC(-78.23);
cout << " Function C: " << functionC(987.889);
cout << " Function F: " << functionF(4, 6, 9);
cout << " Function F: " << functionF(6, 4, 9);
cout << " Function G: " << functionG(92);
cout << " Function G: " << functionG(91);
cout << " Function H: " << functionH('K');
cout << " Function H: " << functionH('8');
cout << " Function H: " <<functionF(1,2,3);
cout << " Function I ";
functionI(9, 12, 6);
system("pause");
return 0;
}
void functionA()
{
cout<<"This is function A"<<endl;
}
int functionB(int a, int b, int c)
{
if(a>b && a>c)
return a;
else if(b>a && b>c)
return b;
else
return c;
}
char functionC(double a)
{
if(a>=0)
return 'p';
else
return 'n';
}
bool functionF(int a, int b, int c)
{
if(a>b && a>c)
return true;
else
return false;
}
bool functionG(int a)
{
return true;
}
bool functionH(char a)
{
return true;
}
void functionI(int a, int b, int c)
{
if(a>b && a>c)
cout<<"Largest: "<< a <<endl;
else if(b>a && b>c)
cout<<"Largest: "<< b <<endl;
else
cout<<"Largest: "<< c <<endl;
}
void displaySplash()
{
cout<<"Welcome!"<<endl;
cout<<"Program name: "<< endl;
cout<<"Programmar name: "<< endl;
cout<<"Production date: "<< endl;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.