IN C++ PLEASE!!! Read integers from input and store each integer into a vector until -1 is read. Do not store -1 into the vector. Then, output all values in the vector that are greater than zero in reverse order, each on a new line.

Ex: If the input is -19 34 -54 65 -1, the output is:

65
34

#include
#include
using namespace std;

int main() {

/* Your solution goes here */

return 0;
}

Answers

Answer 1
#include
#include
using namespace std;

int main(){

int input[] = {-19, 34, -54, 65, -1};
std::vector voutput:
std::vector vinput (input, input + sizeof(input) / sizeof(int) );

for (std::vector::iterator it = vinput.begin(); it != vinput.end(); ++it)
if(*it > 0) voutput.insert(voutput.begin(), *it);
for(std::vector::iterator it = voutput.begin(); it < voutput.end(); ++it)
std::cout << *it << ‘\n’ ;

return 0;
}
Answer 2

The program is an illustration of vectors; vectors are data structures that are used to hold multiple values in one variable name

The main program

The program written in C++, where comments are used to explain each action is as follows:

#include <iostream>

#include <vector>

using namespace std;

int main(){

   //This declares the vector

   vector<int> nums;

   //This declares an integer variable

   int num;

   //Thie gets the first input

   cin>>num;

   //This loops is repeated until the user enters -1

   while(num != -1){

       nums.push_back(num);

       cin>>num; }  

   //This iterates through the vector

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

       //This checks if the current element is above 1

       if(*i > 0){

           //If yes, the element is printed

           cout << *i <<endl;

       }      

   }

       return 0;

}

Read more about C++ programs at:

https://brainly.com/question/24027643


Related Questions

What is meaning of geo and bio​

Answers

Answer:

Geo means Earth and Bio mean life

A transition is ________.

Answers

Answer:

the process or a period of changing from one state or condition to another.

Explanation:

"students in transition from one programme to another"

A java program is composed of data members and functions.​
true or false ?

Answers

Answer:

true

Explanation:

what do you mean by networking devive?​

Answers

Answer:

Networking Device are Those Device which are required for communicating and interacting between device and a computer network.

Explanation:

Your help desk has informed you that they received an urgent call from the vice president last night requesting his logon ID and password. You discussed about the call with the VP today and you got to know he never made that call. What type of attack is demonstrated in the given scenario

Answers

Answer:

Social Engineering Attack

Explanation:

The exploitation of individuals in order to gain confedential information is a Social Engineering Attack. These attacks typically take advanage of one's emotions or they use inpersonaltion to steal data.

read more here: https://www.webroot.com/us/en/resources/tips-articles/what-is-social-engineering

Lmk if this helps! :)

what are the means of hardware security?​

Answers

Answer:

Hardware security is vulnerability protection that comes in the form of a physical device rather than software that is installed on the hardware of a computer system. ... Common examples include hardware firewalls and proxy servers.

Explanation:

Thank you

Explanation:

Hardware security is vulnerability protection that comes in the form of a physical device rather than software that is installed on the hardware of a computer system. ... Common examples include hardware firewalls and proxy servers.

How is IT used in entertainment to make cartoon movies

Answers

Answer:

Forensic animation is a branch of forensics in which animated recreation of incidents are created to aid investigators & help solve cases. Examples include the use of computer animation, stills, and other audio visual aids.

hope you will get this answer correct

The information included in a résumé should always relate to the job objective; if it isn’t related, it shouldn’t be included.

Answers

Answer:

True.

Explanation:

A resume (curriculum vitae) can be defined as a short text-based document that a job applicant use to briefly outline his or her qualifications, abillities and accomplishments, haven completed and obtained an academic certificate. Thus, it is used to briefly outline a person's qualifications, abillities, skills set, and accomplishments, after completing and obtaining an academic certificate such as a bachelor's degree, master's degree, etc.

Generally, all job applicants are required to have a resume (curriculum vitae). This brief and concise document is always requested by human resource managers during the job application process.

Furthermore, the primary way to make a resume persuasive (to convince or inform an action in the minds of the readers - potential employers) is by customizing it to fit each company and position.

Hence, the information included in a résumé should always relate to the job objective; if it isn’t related, it shouldn’t be included.

This ultimately implies that, job applicants are expected to tailor their resume to fit or match the position that is advertised by a company's human resources department.

Which of these is an example of an IT career? (ik I'm trash at this kinda stuff)


Select all that apply

A

game designer


B

network engineer


C

graphic designer


D

cashier

Answers

Answer:

not d

Explanation:

IT is info tech, so it's most likly a or c(I'mma go witn c), but then again b is possible, but c still sounds most reasonable(I think)

...............is a personal computer that fits on desk.​

Answers

Answer:

desktop computer

Explanation:

¿Cuál es la ventaja principal de una tabla dinámica?

Answers

Explanation:

Ventajas de las tablas dinámicas de Excel:

Hacen que los informes sean flexibles y se adaptan a tus necesidades. Son una forma interactiva de resumir rápidamente grandes volúmenes de datos, haciendo mucho más fácil el proceso de análisis y permitiendo encontrar patrones o tendencias.

how do I answer question

Answers

Answer:

To answer a question on brainly, there is a add answer button below the question. Please look at the attached, it shows you the add answer button.

Explanation:

Once you click on add answer, brainly will take you to something that looks like a note and all you have to do is type the answer and explanation. Once you do that, click on the add your answer button on the top right corner, and your answer will be posted.

What is the output of the following C++ code? int list[5] = {0, 5, 10, 15, 20}; int j; for (j = 0; j < 5; j++) cout << list[j] << " "; cout << endl; Group of answer choices 0 1 2 3 4 0 5 10 15 0 5 10 15 20 5 10 15 20

Answers

Answer:

what?

Explanation:

Are all the computer users known as programmer ​

Answers

Answer:

Nope

Explanation:

programmers are diff

20 points!!!!! Plz answer quickly

Answers

Answer:

other words are not clear

what is robotic technology

Answers

Answer:

according to britannica :

"Robotics, design, construction, and use of machines (robots) to perform tasks done traditionally by human beings. ... Robots are widely used in such industries as automobile manufacture to perform simple repetitive tasks, and in industries where work must be performed in environments hazardous to humans"

Explanation:

You are a trainer for your company and often teach courses in a classroom located on-campus or in a hotel conference room. In your office, which is separate from the classroom, you have two external monitors connected to your laptop, and you are able to display different content on each monitor. However, when teaching, you only have your laptop and a projection unit. To make teaching easier, you want the same content to show on both the laptop monitor and the projection screen.
Which of the following multiple display options would be BEST to select when teaching?
A. Show only on 1.
B. Extend these displays.
C. Show only on 2.
D. Duplicate these displays.

Answers

Answer:

Duplicate these displays.

Explanation:

A. Show only on 1 displays only the first screen and disconnects the second one

B. Extend these displays displays two different outputs on the same computer

C. Show only on 2. displays only the second screen and disconnects the first one

D. Duplicate these displays. displays the same output for both screen

Answer:d. Duplicate these displays

Explanation:

What is the Sparklines group for in Excel? to place charts in individual cells working with hyperlinks selecting font styles or themes formatting the appearance of the cells or tables

Answers

Answer:

A sparkline is a tiny chart in an Excel worksheet cell that provides a visual representation of data.

what is a common translator?​

Answers

Answer:

Conventional interpretation is the process of converting (simultaneously or sequentially) a word/sentence/paragraph/text from one language to another in spoken form without changing the meaning, helping people who do not share the same language. one language can understand each other.

Explanation:

Answer:

A translator is a programming language processor that converts a computer program from one language to another . It takes a program written in source code and converts it into machine code. It discovers and identifies the error during translation.

How can computer be beneficial in agriculture and tourism​

Answers

The production capacity in farming and animal husbandry has increase due to use of computer in agriculture field . There are less losses due to work are monitored by computer. By using computer in traditional field like agricultural field we can increase the productivity and minimize the error happen.

If an angry person called and demanded to speak with the executive you support, who is currently unavailable, how would you handle it?

Answers

Answer: be nice no matter how mean or rude the person is.

Explanation: because if you’re not you can get in big trouble or fired.

Answer:

remain  calm during the conversation

How to execute python code in command prompt *window*?

Iam using sublime text 3 and want to execute my python code in command prompt.
This is my current build system:

{
"cmd": ["python", "$file"],
"selector": "source.python",
"file_regex": "^\\s*File \"(...*?)\", line ([0-9]*)"
}

But I want my program to open in command prompt window and show the result there. I dont want to see the result in sublime text. Please help.

Answers

Answer:

Open Command Prompt and type “python” and hit enter. You will see a python version and now you can run your program there

write a program in python to make the figure:-

*
**
****
********
****************
********************************

The first and correct answer will be marked as brainliest......​

Answers

Answer:

Halo mateeeee

look it will be hard to explain the code and steps to you so just refer this video. .

it will help a lott

( *cries* Serena left Ash In pokemon s19 with a k I s s)

https://youtu.be/rUy_Nq9DHTs

how big is an iphone xr

Answers

Answer:

the iPhone xr display measure in at 6 .1 inches

the phone measures up to 6.1 in

Portable computer, also known as laptop computer, weighing between 4 and 10 pounds is called a. Internet b. Scanner c. Printer d. Notebook computer​

Answers

Explanation:

portable computer also known as laptop computer weighting between 4 to 10 pounds is called a Notebook computer.

c) Explain GIGO briefly.​

Answers

Answer:

Is is also a computer science acronym that implies bad input will result in bad output. Requiring valid input also helps programs avoid errors that can cause crashes and other erratic behavior.

IT'S FORMULA IS GIGO: GARBAGE IN GARBAGE OUT...

HOPE IT'S HELPFUL FOR U!!

AND PLZ MARK ME AS BRAINLIEST IF U LIKE THIS ANSWER!!!!

You have been hired to perform a penetration test for an organization. You are given full knowledge of the network before the test begins. Which type of penetration test are you performing

Answers

Answer:

If you are performing a penetration test with knowledge you are known as a white-hat hacker.

16. Which of the following is true about function return statements? A) A function can hold multiple return statements, but only one return statement executes in one function call. B) A function can hold only one return statement. C) A function can hold multiple return statements, and multiple return statements can execute in one function call. D) A function can have maximum of two return statements.

Answers

Answer:

A) A function can hold multiple return statements, but only one return statement executes in one function call

Explanation:

This is because each function can only return one value, whether it be an integer, String, or other object.

However, you can have a series of if-else statements, or case statements, to return a different value depending on information (within parameters, or variables.

Excellent. So, you can have multiple return statements, but the function will only end up executing one of these return statements and return a single value.

Hope this helps!

The statement "When there are multiple return statements but one return statement should execute the 1 function call" is true.

The following information should be considered:

This can be done as every function has only a return i.e. one value. It can be an integer, string, or any other thing. The function can't hold only 1 return statement.The function can't hold many return statements that execute one function call. The function can't have the utmost 2 return statements.

Therefore, we can conclude that option A is correct.

Learn more about the function here: brainly.com/question/12431044

A database planner names a field “Organic ingredients_3”. Why would this name Create possible problems in programming?

Answers

Answer:

I think the answer is 2.

hope it will help you

Because it contains an embedded space

What is the difference, if any, between a project manager and a producer on a digital media production team? A project manager oversees the entire project, while the producer just oversees the creative element. A project manager just oversees the creative element, while a producer oversees the entire project. A project manager is in charge of the people involved in the project, while the producer secures the funds. A project manager secures the funds for the project, while the producer is in charge of the people involved.

Answers

Answer:

A project manager just oversees the creative element, while a producer oversees the entire project.

It is B

Answer:

b

Explanation:

got it right on the quiz

Other Questions
If P = (2,-1), find the imageof P under the following rotation.270 counterclockwise about the origin([?], [])Enter the number that belongs inthe green box. where is the location of the incenter of triangle abc is Fill in the table using this function rule.y=-10x+3 what is six-sevenths divided by three-fourteenths? Linoleic acid is a polyunsaturated fatty acid found, in ester form, in many fats and oils. Its doubly allylic hydrogens are particularly susceptible to abstraction by radicals, a process that can lead to the oxidative degradation of the fat or oil.a. Trueb. Flase A structural model of retinol is shown below. How many carbon atoms are inretinol?. 14. 28. 20D. 5 How would you describe the gods of Alejandro's earliest Mexican ancestors? It is hard to understand why the U.S. Food and Drug Administration (FDA) has become a punching bag for politicians and business people who complain about federal regulations and laws. The FDA tries to make sure that food and medicines are safe, and what is wrong with that Age differences in __________ memory are much smaller than in __________ memory. explicit; implicit episodic; semantic implicit; explicit associative; implicit A 20-mm-diameter steel bar is to be used as a torsion spring. If the torsional stress in the bar is not to exceed 110 MPa when one end is twisted through an angle of 15, what must be the length of the bar? give me a fully balanced equation of lead monoxide and nitric acid 1) Jackie never yelled back, though, and he never hid to avoid their meanness, either. 2) Jackie was calm and strong.What is the best way to describe the excerpt?Sentence 1 has direct characterization. Sentence 2 has indirect characterization.Sentence 1 has indirect characterization. Sentence 2 has direct characterization.Both sentences have direct characterization.Both sentences have indirect characterization. Where does the first stage of cellular respiration occur?Use this diagram of an animal cell to answer thequestionOWOXOYOZ sin4x - cosx ---------------- = f(x) f^1(/4) what is the derivative? tanx Jerry needs 216 posts to build a fence. He has 88 posts and needs P more. Write an equation that you could use to find the number of posts jerry still needs. Most streams result from _____. a. altitude b. melted snow c. oceans d. rivers Slavery was legal in America for approximately _______ years. how does stress affect your respiratory system?a. rapid breathingb. shortness of breath c. slow breathingd. inability to breathe according to bacon what are three purpose of studies discuss them briefly HELP PLEASSSSSS I will give brainlyest!!!!!!!!!!!!!!!!!!