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

50. struct type salesPerson has a component sales, which is an array fo 50 sales

ID: 3559773 • Letter: 5

Question

50. struct type salesPerson has a component sales, which is an array fo 50 sales totals. Write the command to display the first sales total for a salesPersonvariable called janeSmith.

48. What is the output of the following code? int myArray[8]; for (int c = 7; c > 2; c--) myArray[c] = c * 4; for (int p = 3; p < 7; p++) cout << myArray[p] << " " ;

47. Write the code that will add ten to the fourth element of an array of integers called ages.

46. How do we refer to the third element in an array called prices?

45. Write statement(s) that reads the information in the record below from stream info to string variables courseName (on the first line) and courseNum and integer variable hours (on the second line).

44.

For the input stream

          [blank][blank] Jane Doe

where will the stream buffer pointer be positioned after the following code?

43. Write a statement that rounds a float variable called size to three decimal places.

40.

What is the output of this function call given the function definition below?

Explanation / Answer

50. struct type salesPerson has a component sales, which is an array fo 50 sales totals.
Write the command to display the first sales total for a salesPersonvariable called janeSmith.

out << "First sales is " << janeSmith.sales[0] << endl;

48. What is the output of the following code?

int myArray[8];
for (int c = 7; c > 2; c--)
myArray[c] = c * 4;
for (int p = 3; p < 7; p++)
cout << myArray[p] << " " ;

myArray[7] = 7*4 = 28
myArray[6] = 6*4 = 24
myArray[5] = 5*4 = 20
myArray[4] = 4*4 = 16
myArray[3] = 3*4 = 12

so output is myArray[3] myArray[4] myArray[5] myArray[6]

12 16 20 24


47. Write the code that will add ten to the fourth element of an array of integers called ages.

ages[3] = ages[3] + 10;

46. How do we refer to the third element in an array called prices?

cout << prices[2] << endl;

45. Write statement(s) that reads the information in the record below from stream info to string variables courseName
(on the first line) and courseNum and integer variable hours (on the second line).

cin >> courseName >>courseNum >> hours;

44.For the input stream           [blank][blank] Jane Doe
where will the stream buffer pointer be positioned after the following code?

char ch;
cin >> ch >> ch; first ch holdes J second ch holds a

points to character 'n'.

43. Write a statement that rounds a float variable called size to three decimal places.

cout << fixed << setprecision(3) << size << endl;

40.What is the output of this function call given the function definition below?
cout << value(5, 3);     // function call

int value(int x, int y)     // function definition
{
     if (y == 1)
          return x;
     else
          return value(x + 1, y - 1);
}

value(5,3)
since y = 3 !=1   calls value(5+1,3-1)
value(6,2)
since y=2!=   callas value(6+1, 2-1)
value(7,1)
since y==1 return x so return 7.

output of function is 7.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote