Computers and Technology

C++ Proagram Write a loop that sets each array element to the sum of itself and the
next element, except for the last element which stays the same.
Be careful not to index beyond the last element. Ex:
Initial scores: 10, 20, 30, 40
Scores after the loop: 30, 50, 70, 40
The first element is 30 or 10 + 20, the second element is 50
or 20 + 30, and the third element is 70 or 30 + 40. The last element
remains the same.
Follow this code
#include
using namespace std;
int main() {
const int SCORES_SIZE = 4;
int bonusScores[SCORES_SIZE];
int i = 0;
bonusScores[0] = 10;
bonusScores[1] = 20;
bonusScores[2] = 30;
bonusScores[3] = 40;
/* Your solution goes here */
for (i = 0; i < SCORES_SIZE; ++i) {
cout << bonusScores[i] << " ";
}
cout << endl;
return 0;
}

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 07:50, kmart4062
Apython programming question: assume s is a string of lower case characters. write a program that prints the number of times the string 'bob' occurs in s. for example, if s = 'azcbobobegghakl', then your program should print number of times bob occurs is: 2
Answers: 3
image
Computers and Technology, 24.06.2019 17:40, orlandokojoasem1234
Write an assembly language program to input a string from the user. your program should do these two things: 1. count and display the number of words in the user input string. 2. flip the case of each character from upper to lower or lower to upper. for example if the user types in: "hello there. how are you? " your output should be: the number of words in the input string is: 5 the output string is : hello there. how are you?
Answers: 2
image
Computers and Technology, 25.06.2019 01:30, babyquinnz
Why is the most liked picture on instagram an eggy? owo
Answers: 1
image
Computers and Technology, 25.06.2019 07:00, denisefaircloth73
Amisfire code is a type diagnostic trouble code (dtc).
Answers: 1
Do you know the correct answer?
C++ Proagram Write a loop that sets each array element to the sum of itself and the
next ele...

Questions in other subjects:

Konu
World Languages, 04.08.2019 00:10