1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lana [24]
3 years ago
11

Read integers from input and store each integer into a vector until -1 is read. Do not store -1 into the vector. Then, output al

l values in the vector (except the last value) with the last value in the vector subtracted from each value. Output each value on a new line. Ex: If the input is -46 66 76 9 -1, the output is:
-55
57
67
Computers and Technology
1 answer:
weqwewe [10]3 years ago
6 0

Answer:

The program in C++ is as follows:

#include <iostream>

#include <vector>

using namespace std;

int main(){

vector<int> nums;

int num;

cin>>num;

while(num != -1){

 nums.push_back(num);

 cin>>num; }  

for (auto i = nums.begin(); i != nums.end(); ++i){

    cout << *i <<endl; }

return 0;

}

Explanation:

This declares the vector

vector<int> nums;

This declares an integer variable for each input

int num;

This gets the first input

cin>>num;

This loop is repeated until user enters -1

while(num != -1){

Saves user input into the vector

 nums.push_back(num);

Get another input from the user

 cin>>num; }

The following iteration print the vector elements

<em> for (auto i = nums.begin(); i != nums.end(); ++i){ </em>

<em>     cout << *i <<endl; } </em>

You might be interested in
In computing, what does LAN stand for?​
Arlecino [84]

Answer:

LAN stands for Local Area Network

4 0
2 years ago
Read 2 more answers
Government expenditures classify as a characteristic of which of the following?
LenKa [72]
Your answer shall be c
5 0
3 years ago
Which programming language represents data in the form of a series of 0s and 1s?
Ivan
Binary is represented by 1s and 0s, and is a machine language
3 0
3 years ago
What happens if a spelling checker does not have a suggestion for a misspelled word?
Viktor [21]
Then the misspelled word is not a word probably, either that or the misspelled word doesn’t look like the desired word
8 0
3 years ago
Read 2 more answers
Any game suggestions for nintindo switch.​
alexira [117]

Answer: animal crossing lol

Explanation:

7 0
3 years ago
Other questions:
  • Describe an application where a parallel circuit might work better than a series circuit
    15·2 answers
  • Software license infringement is also often called software __________.
    11·2 answers
  • Conduct online research to determine specific conflict-resolution and management techniques and skills that would be beneficial
    5·1 answer
  • Workspace Remember for a moment a recent trip you have made to the grocery store to pick up a few items. What pieces of data did
    13·1 answer
  • A(n) _________ is a computer system which is part of a larger system which performs a dedicated function.
    8·1 answer
  • What is Digital Access, and why is it important for YOUR generation?
    9·1 answer
  • Could somebody please find the bugs and amend them? This question is worth 25 Brainly points!
    11·1 answer
  • Types of computer viruses<br>​
    5·2 answers
  • The __________ algorithm takes the ciphertext and the secret key and produces the original plaintext
    11·1 answer
  • Which block cipher mode of operating requires that both the message sender and receiver access a counter that computes a new val
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!