Doing some practice questions to prepare for a test next week for C++ and need s
ID: 3889339 • Letter: D
Question
Doing some practice questions to prepare for a test next week for C++ and need some help figuring these out. The focus is on arrays. I've done the large majority of them but these are the ones I'm struggling with.
Link to questions are here: https://imgur.com/a/DmxHC
// 1. Reed value into the ixth element of arrey . [NO PROMPT] // 2. Read value into the tenth element of arrey . [NO PROMPT] Function: Conplete the foilouing progran to read in , the a1ze 1. Read a value into the third aay element NO EROMEC 2. Complete the body of function PrintRevese, which prints 3. Compute the sun of the first 10 elenents ir array A // 4. Print the 5un. NO LABEL) of an integer array, followed by integer values. Then display OHE LINE the values in reveree order of input. Example: input i - output -2 4 9182 NOre: array size must be between 0 and 10 Example: input 3- output // Example: Input: 4 9 3 e => Output: REVERSE: 8 3 9 1 include c1oatream: 31ng naneapace atd: nt maino uaing nameapace atd: void PrincReverae (int array, int arrar51ze) int Sun-99 int A1-2,8, 3,9,4,-2,,12,42,-20,4, 31 include ciostream> include cionan p> int main nt main o int A[]-12,9,3,9,4,-2 coutExplanation / Answer
1.
cin >> A[5];
cin >> A[9];
Sum = 0;
for(int i = 0; i<10; i++){
Sum = Sum + A[i];
}
2. cin >> n;
for (int i = 0; i<n; i++)
cin >> A[i];
for (int i = n-1; i<=0; i--)
cout << A[i] << " ";
3. cin >> Q[5];
cin >> Q[2];
NegSum = 0;
for(int i = 0; i<8; i++){
if (Q[i] < 0)
NegSum = NegSum + Q[i];
}
4.
PLAYER data[20];
int numPlayers;
Load_Game(numPlayers, data);
double sum = 0;
for (int i = 0; i<numPlayers; i++){
sum = sum + data[i].Pts;
}
cout << setprecision(1) << sum/numPlayers << endl;
5. cin>>CAP;
int pos;
int *EVEN = new int[CAP];
int a = 0;
for (int i = 0,; i <CAP; i = i++){
EVEN[i] = a;
a = a+2;
}
cin << pos;
cout << EVEN[pos-1];
6 char A[7];
int i1,i2,j1,j2;
char a,b
for (int i = 0; i<7; i++)
A[i] = 'Z';
cin>>i1 >> i2 >> a >> b >> j1 >> j2;
A[i1] = a;
A[i2] = b;
cout << A[j1] << A[j2];
7. int A[25];
int n;
Load(n,A);
int num = 0;
for (int i = 0; i<n; i++)
if (A[i] <0)
num++;
cout << num;
8.
cin >> A[2] // This is in main for taking the input.Following is the body of the function
for(int i = arraySize-1; i <= 0; i--)
cout << array[i] << " ";
cout << endl;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.