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
solong [7]
3 years ago
3

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

values in the vector that are not equal to the last value in the vector, each on a new line.
Ex: If the input is -90 -10 22 -10 0, the output is:

-90
22
#include
#include
using namespace std;

int main() {

/* Your code goes here */

return 0;
}
Computers and Technology
1 answer:
Alexeev081 [22]3 years ago
3 0

Answer:

The program is as follows:

#include<iostream>

#include<vector>

using namespace std;

int main() {

vector<int> myInputs;

int num;

cin>>num;

while(num !=0){

   myInputs.push_back(num);

   cin>>num;}

for (int i = 0; i < myInputs.size(); i++){

       if(myInputs[myInputs.size()-1]!=myInputs[i]){

           cout << myInputs[i] << " ";        }

       }

return 0;

}

Explanation:

Declare integer vector of elements

vector<int> myInputs;

Declare num for integer inputs

int num;

Get input for num

cin>>num;

This loop is repeated until input is 0

while(num !=0){

Push the input to the vector

   myInputs.push_back(num);

Get another input

   cin>>num;}

Iterate through the vector elements

for (int i = 0; i < myInputs.size(); i++){

For vector elements not equal to the last element

       if(myInputs[myInputs.size()-1]!=myInputs[i]){

The element is printed

           cout << myInputs[i] << " ";        }

       }

You might be interested in
Font size means the height of characters.<br>True<br>False​
svlad2 [7]
True..................
8 0
3 years ago
HELP!!!
jeyben [28]

Answer:

A. a tool tip

Explanation:

6 0
3 years ago
Read 2 more answers
Mrs. Sims polled her students about which social media app they use most. Which type of chart would best display this data?
Troyanec [42]
The best way to display this data is c. Pie chart
8 0
3 years ago
Read 2 more answers
What type of information is appropriate for headers and footers? Check all that apply.
lbvjy [14]

Answer:

slide/page number

smart art

maybe date and time

Explanation:

6 0
3 years ago
Read 2 more answers
The programmer must initialize variables when they are declared
lorasvet [3.4K]

Answer: When you declare a variable, you should also initialize it. Two types of variable initialization exist: explicit and implicit. Variables are explicitly initialized if they are assigned a value in the declaration statement. Implicit initialization occurs when variables are assigned a value during processing.

Explanation:

For example, in JavaScript

var PaintAmount = 50; -declare and initialize  

function setup() {

   creatCanvas(200, 200);

}  

function draw() {

   ellipse(PaintAmount, PaintAmount) -use the variable PaintAmount

}

or rather in Java,

package random;

public class something() {

Public static void Main(String []args) {

        string name;  // this is declaring the variable with the example type  

     

       string name = new string; //this initializes the declared variable

}

}

6 0
3 years ago
Other questions:
  • Collaboration, listening, and negotiating are considered __________ skills.
    7·2 answers
  • Three business partners are forming a company whose name will be of the form "name1, name2 and name3". however, they can't agree
    13·1 answer
  • What does the regular expression [a-z0-9\-] mean?
    8·1 answer
  • 7.4.1C The global distribution of computing resources raises issues of equity, access, and power. Briefly describe one of these
    11·1 answer
  • If you need to set up direct deposit, which information from your check would you likely need?
    7·2 answers
  • Write a VB.Net program to print numbers from 10 to 20 in descending order using a For Statement.
    14·1 answer
  • Free 35 points!!!
    11·2 answers
  • Which soft skills would these mobile app developers need to use in the situations described?
    8·2 answers
  • You have a passage of text that needs to be typed out, but some of the letter keys on your keyboard are broken! You're given an
    14·1 answer
  • Which X software package is designed to be a more streamlined and easier to use replacement for the X Window System
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!