Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1-Assign to maxSum the max of (numA, numB) PLUS the max of (numY, numZ). Use jus

ID: 3565394 • Letter: 1

Question

1-Assign to maxSum the max of (numA, numB) PLUS the max of (numY, numZ). Use just one statement. Hint: Call FindMax() twice in an expression.

Sample program:

2-Define a function PrintFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand. Ex: PrintFeetInchShort(5, 8) prints:

Hint: Use " to print a double quote.

Sample program:

3-Complete the PrintTicTacToe function with char parameters horizChar and vertChar that prints a tic-tac-toe board with the characters as follows. End with newline. Ex: PrintTicTacToe('~', '!') prints:



Sample program:

4-Complete the PrintShape() function to print the following shape. End with newline.
Example output:



Sample program:

5-Complete the function definition to print five asterisks ***** when called once (do NOT print a newline). Output for sample program:



Sample program:

all i need is just the code for each of the above ..pls

Explanation / Answer

please rate - thanks

I'm assuming you've learned for loops. if not let me know and I'll make the changes

#include <iostream>
using namespace std;
double FindMax(double num1, double num2) {
   double maxVal = 0.0;

   if (num1 > num2) { // if num1 is greater than num2,
      maxVal = num1; // then num1 is the maxVal.
   } else {           // Otherwise,
      maxVal = num2; // num2 is the maxVal.
   }
   return maxVal;
}

int main() {
   double numA = 5.0;
   double numB = 10.0;
   double numY = 3.0;
   double numZ = 7.0;
   double maxSum = 0.0;

   //<STUDENT CODE>
maxSum=FindMax(numA,numB)+FindMax(numY,numZ);
   cout << "maxSum is: " << maxSum << endl;

   return 0;
}

------------------------------------------------------

#include <iostream>
using namespace std;

//<STUDENT CODE>
void PrintFeetInchShort(int ft,int inch)
{cout<<ft<<"'"<<inch<<""";
}
int main() {
   PrintFeetInchShort(5, 8);
   cout << endl;

   return 0;
}

--------------------------------------------------

#include <iostream>
using namespace std;

void PrintTicTacToe(char horizChar, char vertChar) {
// <STUDENT CODE>
int j,i;
for(j=1;j<=2;j++)
   {cout<<"x"<<vertChar<<"x"<<vertChar<<"x"<<endl;
   for(i=1;i<=5;i++)
        cout<<horizChar;
   cout<<endl;
}
   cout<<"x"<<vertChar<<"x"<<vertChar<<"x"<<endl;  
   return;
}

int main() {
   PrintTicTacToe('~', '!');

   return 0;
}

------------------------------------

#include <iostream>
using namespace std;

void PrintShape() {
// <STUDENT CODE>
int i,j;
for(i=1;i<=3;i++)
      {for(j=1;j<=3;j++)
          cout<<"*";
      cout<<endl;
      }
   return;
}

int main() {
   PrintShape();

   return 0;
}

--------------------------------------------

#include <iostream>
using namespace std;

void PrintPattern() {
   //<STUDENT CODE>
   int i;
   for(i=1;i<=5;i++)
       cout<<"*";
}

int main() {
   PrintPattern();
   PrintPattern();
   cout << endl;
   return 0;
}