subject

Write a loop that sets each vector 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, 40Scores after the loop: 30, 50, 70, 40The 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. Sample program:#include #include using namespace std;int main() { const int SCORES_SIZE = 4; vector bonusScores(SCORES_SIZE); int i = 0; bonusScores. at(0) = 10; bonusScores. at(1) = 20; bonusScores. at(2) = 30; bonusScores. at(3) = 40; for (i = 0; i < SCORES_SIZE; ++i) { cout << bonusScores. at(i) << " "; } cout << endl; return 0;}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 18:00
Kyle wants to access his school’s home page. how can he do this?
Answers: 1
question
Computers and Technology, 22.06.2019 03:30
Identify at least three types of characteristics that you were asked about as you the computer identify a fruit.
Answers: 3
question
Computers and Technology, 22.06.2019 17:50
Farah works in an office with two other employees. all three share a printer and an internet connection. the utility that makes this possible is defragger quicktime soho winzip
Answers: 1
question
Computers and Technology, 22.06.2019 22:50
Assume the existence of a bankaccount class. define a derived class, savingsaccount that contains two instance variables: the first a double, named interestrate, and the second an integer named interesttype. the value of the interesttype variable can be 1 for simple interest and 2 for compound interest. there is also a constructor that accepts two parameters: a double that is used to initialize the interestrate variable, and a string that you may assume will contain either "simple", or "compound", and which should be used to initialize the interesttype variable appropriately. there should also be a pair of functions getinterestrate and getinteresttype that return the values of the corresponding data members (as double and int respectively).
Answers: 2
You know the right answer?
Write a loop that sets each vector element to the sum of itself and the next element, except for the...
Questions
question
History, 04.07.2019 03:30
question
History, 04.07.2019 03:30
question
Biology, 04.07.2019 03:30
Questions on the website: 13722362