answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alex787 [66]
2 years ago
7

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:
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;

cout << "maxSum is: " << maxSum << endl;
return 0;
}
2. Define a function PrintFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand. Ex: PrintFeetInchShort(5, 8) prints:
5' 8"
Hint: Use \" to print a double quote.
Sample program:
#include
using namespace std;

int main() {
PrintFeetInchShort(5, 8);
cout << endl;
return 0;
}
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:
x!x!x
~~~~~
x!x!x
~~~~~
x!x!x
Sample program:
#include
using namespace std;
void PrintTicTacToe(char horizChar, char vertChar) {

return;
}
int main() {
PrintTicTacToe('~', '!');
return 0;
}
4. Complete the PrintShape() function to print the following shape. End with newline.
Example output:
***
***
***
Sample program:
#include
using namespace std;
void PrintShape() {

return;
}
int main() {
PrintShape();
return 0;
}
5. Complete the function definition to print five asterisks ***** when called once (do NOT print a newline). Output for sample program:
**********
Sample program:
#include
using namespace std;
void PrintPattern() {

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

Computers and Technology
1 answer:
Roman55 [17]2 years ago
3 0

Answer:

1)

maxSum = FindMax(numA, numB) + FindMax(numY, numZ);

2)

void PrintFeetInchShort(int numFeet , int numInches){

cout<<numFeet<<"'"<<numInches<<"\""; }

3)

void PrintTicTacToe(char horizChar, char vertChar){

   for(int r=1;r<=3;r++)    {

       for(int c=1;c<=3;c++)        {

           cout<<"x";

           if(c<=2)            {

               cout<<vertChar;     }        }

       cout<<endl;

       if(r != 3)  {

           for(int c = 1; c<=5; c++)            {

              cout<<horizChar;            }

           cout<<endl;        }    } }

4)

void PrintShape(){

for(int r=1;r<=3;r++){

for(int c=1;c<=3;c++){

cout<<"*"; }

cout<<endl;} }

5)

void PrintPattern(){

for(int r=1;r<=5;r++){

   cout<<"*"; } }

Explanation:

1.

In the statement, maxSum is a double type variable which is assigned the maximum of the two variables numA numB PLUS the maximum of the two variables numY numZ using which are found by calling the FindMax function. The FindMax() method is called twice in this statement one time to find the maximum of numA and numB and one time to find the maximum of numY numZ. When the FindMax() method is called by passing numA and numB as parameters to this method, then method finds if the value of numA is greater than that of numB or vice versa. When the FindMax() method is called by passing numY and numZ as parameters to this method, then method finds if the value of numY is greater than that of numZ or vice versa. The PLUS sign between the two method calls means that the resultant values returned by the FindMax() for both the calls are added and the result of addition is assigned to maxSum

2.

The above function takes two integer variables numFeet and numInches as its parameters. The cout statement is used to print the value of numFeet with a single quote at the end of that value and  print the value of numInches with double quotes at the end of that value. Here \ backslash is used to use the double quotes. Backslash is used in order to include special characters in a string. In order to add double quotes with a string or a value, backslash is compulsory.

3.

The function PrintTicTacToe has two character type (char) parameters  horizChar and vertChar.

The function has two loops; outer loop and an inner loop. The outer loop is used to iterate through the rows and inner loop is used to iterate through the columns. The inner loop iterates and prints a row of the character "x" followed by  vertChar which contains a character ! . This means at each iteration x! is printed and it stops at the third "x" as the loop variable c iterates until the value of c remains less than or equal to 3. Notice that the last "x" in each row is not followed by a "!" because of if(c<=2) condition which prints ! only till the second column which means cout<<vertChar; statement only executes until the value of c remains less than or equal to 2. When the value exceeds 2 then the next if statement  if(r != 3) executes which checks if the value of r is not equal to 3.  If this condition is true then the loop inside this 2nd if statement executes which prints value of horizChar at each iteration and horizChar contains "~". c<=5; means that the loop will print "~" 5 times. After the first row of x!x!x and ~~~~~ are printed the outer loop executes for the next iteration and outer loop variable r is incremented to one to print the second row of x!x!x

~~~~~ using inner loop and two if conditions. This outer loop body executes 3 times.

4.

The function has two loops an inner and outer loop. Outer loop is used for rows and inner for columns. At each iteration of inner loop an asterisk is printed and the inner loop runs for 3 times which means three asterisks will print ***. The outer loop executes for 3 times which means total three rows of three *** asterisks are displayed each ***  asterisks are printed with a new line using cout<<endl; statement.

5.

The function uses a loop for(int r=1;r<=5;r++) to print 5 asterisks ***** without printing a new line. The function PrintPattern() is called twice which means the pattern of 5 asterisks ***** is printed twice as: ********** without printing a new line between them.

You might be interested in
Multiple boolean expressions can be combined by using a logical operator to create ________ expressions.
Licemer1 [7]
<span>Boolean expressions can be combined by using a logical operator to create compound expressions. A boolean expression is an expression that takes into account and evaluates specific data, which is in the form of true and/or false. A compound expression is merely a statement of expressions.</span>
8 0
2 years ago
Which element of the word program window contains buttons for saving a document and for undoing, redoing, and repeating a change
miskamm [114]
The answer is the Quick Access Toolbar. However, it is not only for saving files or undoing your work. Containing a set of commands that are independent, this toolbar is actually customizable wherein you could change these icons to the ones you really need and frequently use. By tweaking the settings, you can even add commands to the Quick Access Toolbar that are not in the ribbon (like New, Open and Print).
7 0
2 years ago
Five routers are to be connected in a point-to-point subnet. between each pair of routers, the designers may put a high-speed li
Natalija [7]

Let assume are lettered A to E in that order. Thus, there will be 10 potential lines: AB, AC, AD, AE, BC, BD, BE, CD, CE and DE. Each of these potential lines has 4 possibilities. Therefore, the total number of topologies is 4¹⁰=1,048,576. 1,048,576. At 100ms <span>it will take 104,857.6 seconds which is slightly above 29 hours to inspect each and one of them.</span>











6 0
2 years ago
Which command suppresses the visibility of a particular Row or column in a worksheet?
leonid [27]

Answer:

Ctrl+Space is the keyboard shortcut to select an entire column.

Explanation:

When you press the Shift+Space shortcut the first time it will select the entire row within the Table.  Press Shift+Space a second time and it will select the entire row in the worksheet.

The same works for columns.  Ctrl+Space will select the column of data in the Table.  Pressing the keyboard shortcut a second time will include the column header of the Table in the selection.  Pressing Ctrl+Space a third time will select the entire column in the worksheet.

You can select multiple rows or columns by holding Shift and pressing the Arrow Keys multiple times.

4 0
2 years ago
Write any 5 activities that help to remove bad events from the society?​
vova2212 [387]

Answer:

1. Awareness program

2. Education

3. women empowerment

6 0
2 years ago
Read 2 more answers
Other questions:
  • What is a cursor?
    6·2 answers
  • Respond to the following in a paragraph of no less than 125 words. Describe the steps to active listening.
    7·2 answers
  • In a system containing CPU 1 and Disk Drive A, the system is instructed to access Track 1, Track 9, Track 1, and then Track 9 of
    12·1 answer
  • Which of the following are true statements about digital certificates in Web browsers?I. Digital certificates are used to verify
    10·1 answer
  • When trying to improve performance of a slow system, you notice in Task Manager that the superfetch service is using a high perc
    11·1 answer
  • (1) Output a menu of automotive services and the corresponding cost of each service. (2 pts) Ex: Davy's auto shop services Oil c
    15·1 answer
  • You are modeling a small part of an online flight reservation system, according to the following description. A flight is a sing
    11·1 answer
  • The Company management has asked that you compare the OSSTMM and the PTES to determine which methodology to select for internal
    13·1 answer
  • Television broadcasts were originally delivered by using which technology
    14·1 answer
  • Identify the tips to create a well-designed digital portfolio.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!