Question: 1. Consider the code below. void This(int that, int those) { those = 5 * that; } ... int main() { int guess = 14;

1. Consider the code below.

void This(int that, int those)

{

those = 5 * that;

}

...

int main()

{

int guess = 14;

This(12,guess);

cout << guess;

...

return 0; //LAST.

}//main

The value of variable guess when the statement //LAST is reached: _____

2. Consider the code below, which produces the output

7 2 4 3

List the values in the the file 'mystuff', which contains exactly 4 values:

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

#include

int Get(string fname, int q)

{

int num;

ifstream inF(fname.c_str());

for (int k=1; k<=q; k++)

inF >> num;

inF.close();

return num;

}

int main()

{

int N;

cout << Get("mystuff",4) << Get("mystuff",1)

<< Get("mystuff",2) << Get("mystuff",3);

return 0;

}

3. Consider the code segment below.

for (int r=2; r<5; r++)

cout << 'X';

for (int c=5; c>1; c=c-2)

cout << c;

The output produced by this code: _______________________

4. Suppose you have the following functions available to you:

void LoadArray(int & numValues, int A[]); // Load values from a file.

void ShowArray(int B[], int numValues); // Display the values in array.

void SortArray(int numValues,int C[]); // Sort array in ascending order.

ON ONE LINE, Complete the FOUR statements in the body of a main program

to accomplish the following:

1. Load values into array T from a file.

2. Display the loaded array T.

3. Sort the array T.

4. Display the sorted array T.

int main()

{

int T[40];

int count = 0; // #values stored in array T.

return 0;

}

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!