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
C++
Ede4ka [16]

Answer:

2 & 3

Explanation:

Only mathematical operations that can be used to change contents of pointer variables include addition, subtraction, comparison, increments and decrements.

Although modulus, division and multiplications are not possible. A snippet of code is attached showing pointers addition and subtraction and their result.

Check it by replacing + or - signs with *, / or % which represent multiplication, division and modulus respectively. It would result in an error.

4 0
4 years ago
The soft-tissue lining of oysters and clams creates pearls. Is a pearl a mineral?
Kisachek [45]
<span>A pearl is not a mineral because it is created artificially. It is a gemstone, not a mineral because it is a composite of mineral Aragonite and a protein compound which is called conchiolin. Pearls are formed by organic and living organisms which is preserved to become a gemstone.</span>
3 0
3 years ago
Read 2 more answers
The _____ model of a systems development life cycle provides for progressive development of operational software, with each rele
dimaraw [331]

Answer:

B. Incremental Build life cycle

Explanation:

RAD life cycle: RAD model of software development life cycle is all about coming up with prototype as soon as possible. It describes a method of software development which heavily emphasizes rapid prototyping and iterative delivery.

Incremental build life cycle: In incremental build model of software development life cycle, each release of the software have added capabilities. The development is finished when the user is okay with the present features. Focus is put on creating a working prototype first and adding features in the development life cycle. This is the correct option.

Waterfall life cycle: In a waterfall model, each phase must be completed fully before the next phase can begin and this usually takes time before a working software can be released. There is also no overlapping in the phases.

Spiral life cycle: Spiral Model can be pretty costly to use and doesn't work well for small projects. It's a risk-driven model which means that the overall success of a project highly depends on the risks analysis phase.

4 0
3 years ago
Read 2 more answers
Which of these is an online presentation tool?
Marina86 [1]
Google slides is and online presentation tool
5 0
3 years ago
Read 2 more answers
To what extent are such practices permitted today under existing laws and codes of behavior?
11111nata11111 [884]
Maximum fine that a hearing panel can impose for an ethics violation is increasing to $15,000.
5 0
3 years ago
Other questions:
  • What is the difference between file and directory​
    12·1 answer
  • ____ is used specifically for the purpose of recording keystrokes, logging the programs or Web sites accessed, or otherwise moni
    6·2 answers
  • Which best describes the condition under which the Unicode output is the same as plain text?
    7·1 answer
  • The _______________ is a priority-ordered list of the other carrier networks and frequencies it should search for when it cannot
    6·1 answer
  • Jenny is working on a laptop computer and notices that the computer is not running very fast. She looks and realizes that the la
    14·1 answer
  • What is the purpose of a transistor?
    13·2 answers
  • Florida law requires every child blank years of age or younger use a crash tested federally be approved child restraint device
    5·2 answers
  • What is not an advantage of a computer network?
    14·1 answer
  • PLEASE HELLPPPPP EVERYONE IS IGNORING THISSSSSSSSSS
    11·1 answer
  • how to get into harvard stanford mit ivy league guaranteed upper middle class need aid 9th grade, computer science major have no
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!