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

I have no textbook, and am a civil engineer trying to get thru a 6 week cs class

ID: 3627648 • Letter: I

Question

I have no textbook, and am a civil engineer trying to get thru a 6 week cs class for graduation :/ any help or suggestions would be a lifesaver!!! (the class is over C++ in LINUX) THANKS!!

1
Declare an array named scores of twenty-five elements of type int .

2
Assume that the array monthSales of integers has already been declared and that its elements contain sales data for the 12 months of the year in order (i.e., January, February, etc.).

Write a statement that writes to standard output the element corresponding to October.

Do not write anything else out to standard output.


3 Given that an array of int named a has been declared, assign 3 to its first element.

4
Given that an array of int named a with 30 elements has been declared, assign 5 to its last element.


5
Assume that an array of int named a has been declared with 12 elements and that the integer variable k holds a value between 0 and 6.

Assign 15 to the array element whose index is k .

6
Given that an array of int named a has been declared, and that the integer variable n contains the number of elements of the array a, assign -1 (minus one) to the last element in a.

7
Declare an array named a of 10 elements of type int and initialize the elements (starting with the first) to the values 10, 20, ..., 100, respectively.

8
Given an array temps of double , containing temperature data, and an int variable n that contains the number of elements in temps :

Compute the average temperature and store it in a variable called avgTemp .

Besides temps , n , and avgTemp , you may use only two other variables -- an int variable k and a double variable total , which have been declared.

9
printArray is a function that has two parameters. The first parameter is an array of int s and the second is an int , the number of elements in the array. The function prints the contents of the array parameter; it does not return a value.

inventory is an array of int s that has been already declared and filled with values. n is an int variable that holds the number of elements in the array.

Write a statement that prints the contents of the array inventory by calling the function printArray .

10
Write a statement that declares a prototype for a function printArray , which has two parameters. The first parameter is an array of int s and the second is an int , the number of elements in the array. The function does not return a value.

11
Write the definition of a function printArray , which has two parameters. The first parameter is an array of int s and the second is an int , the number of elements in the array. The function does not return a value. The function prints out each element of the array, on a line by itself, in the order the elements appear in the array, and does not print anything else.

12
Declare a 8x8 two-dimensional array of strings named chessboard.

13
Declare a two-dimensional array of integers name arr with 3 rows and 10 columns.

14
Given:
an int variable k ,
an int array currentMembers that has been declared and initialized,
an int variable nMembers that contains the number of elements in the array,
an int variable memberID that has been initialized, and
a bool variable isAMember ,


Write code that assigns true to isAMember if the value of memberID can be found in currentMembers , and that assigns false to isAMember otherwise.

Use only k , currentMembers , nMembers , and isAMember .

15
Given an array arr of type int , along with two int variables i and j , write some code that swaps the values of arr[i] and arr[j] . Declare any additional variables as necessary.

Explanation / Answer

1. int scores[25]; 2. cout