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
You work as a network technician for uCertify Inc. You have erased data saved in your laptop. You still have many device configu
zloy xaker [14]

Answer:

Data remanence

Explanation:

Data remanence is the retention of erased data on a magnetic medium. Sensitive detection systems can pick up the residue (remnants) from previously recorded data even though the area has been rewritten.

This is not a simple procedure; however, it is employed if the <u>missing information</u> is related to national defense or some other critical situation

7 0
4 years ago
Explain the process of a for loop and how it is used in code
marshall27 [118]

Ex:

FOR Count= 1 TO 50

.......................

Body

......................

NEXT

Next keeps incrementing count by 1

Hope it helps

4 0
3 years ago
What is the Best decent priced Laptop/PC
luda_lava [24]

I'm on a brand new Lenovo and it was only like $500. Its great, especially if you are looking for a gaming Laptop. Otherwise, HP and Lenovo's older stuff is fairly decent in price

6 0
4 years ago
. Explain the notions of WAN, LAN, MAN and PAN.
qaws [65]

Answer:

Explanation:

  1. WAN (Wide Area Network), is a computer network that joins several local networks, although their members are not all in the same physical location.
  2. LAN (Local Area Network) is a network of computers that cover in a small area for example a house, an apartment or a building. One part of the topological definition is the physical topology, which is the actual arrangement of the cables or media.
  3. MAN (metropolitan area network) is a network of computers that interconnects users with computer resources in a geographic area or region larger than area covered by a large local area network (LAN)
  4. PAN (Personal Area Network.) Is a network used to connect different personal computer devices centered on an individual person workspace.
4 0
3 years ago
What are the columns in a Microsoft Access table called?
givi [52]

Answer:

Field. In Access, columns are referred to as fields. When you organize your data by entering it into different fields, you are organizing it by type.

3 0
3 years ago
Other questions:
  • When a program lets the user know that an invalid choice has been made, this is known as:?
    6·1 answer
  • Whatis meant by Translation Lookaside Buffer?
    5·1 answer
  • If you have related data stored in multiple tables, create a(n) ________ to produce a pivottable on the combined data.
    13·1 answer
  • Special instruments can be attached to a telescope's _______________to enable astronomers to enhance by brightening or enlarging
    8·1 answer
  • What term identifies the physical interface between a computer and its peripherals?
    5·1 answer
  • With a DUI charge on a driver’s record ______________.
    10·1 answer
  • Select the correct answer.
    13·2 answers
  • Write the thesis statment of research paper​
    5·1 answer
  • a customer is traveling to a branch office, and the network administrator provides her with a static ip address for her laptop.
    8·1 answer
  • If you are referencing cell (C2)in Excel and want to be able to copy the formula and keep using the data in cell C2 in every pla
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!