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

Change the case of letter by​

Answers

Answer:

writing it as a capital or lower case.

Explanation:

T - upper case

t - lower case

not sure if that is what you meant or not

Answer:

Find the "Bloq Mayus" key at the left side of your keyboard and then type

Explanation:

Thats the only purpose of that key

The core difference between phishing and spear-phishing is: a. spear-phishing has more specific targets than phishing b. phishing attacks via email, spear-phishing attacks via infected webpages c. phishing attacks via email, spear-phishing attacks via social media d. phishing is an outside attack; spear-phishing is an internal security check e. anti-virus software prevents phishing but not spear-phishing

Answers

Answer:

a. spear-phishing has more specific targets than phishing

Explanation:

The difference between phishing and spear-phishing basically lies in the target. Phishing is a form of malicious software sent to a large number of people, probably through their e-mails, with the hope that a small percentage will fall victim to the attack.

Spear-phishing, on the other hand, is targeted at just one person. The person and his itinerary are studied and a message is designed to apply to that person and elicit his interest. Clicking on the message or link exposes the person's device to attack and unauthorized information might be obtained or malware is installed.

Communication media that use an antenna for transmitting data through air or water are called _____.

Answers

Answer:

Guided media provide a physical path along which the signals are propagated; these include twisted pair, coaxial cable and optical fiber. Unguided media employ an antenna for transmitting through air, vacuum or water. Traditionally, twisted pair has been the workhorse for communications of all sorts.

Explanation:

douc54.cs.edinboro.edu /~bennett/class/csci475/spring2002/notes/chapter4/index.html

copy and paste that it might help!

How get end portals in mope

Answers

Answer:

what

Explanation:

A 2-dimensional 3x3 array of ints, has been created and assigned to tictactoe. Write an expression whose value is that of the middle element in the middle row.

Answers

Answer:

tictactoe[1][1]

Explanation:

To access arrays, square boxes might be used which means specifying the row position and column position of a certain value in an array ::

Given a 2 - dimensional 3×3 array of integers :

Creating a dummy array assigned to the variable tictactoe :

[1 2 3]

[4 5 6]

[7 8 9]

We have a 3×3 array, that is 3 rows and 3 columns.

The middle element in the middle row is located in the second row ;second colum

Row and column Indexes starts from 0

Middle element in the middle row is the value 5 and it corresponds to :

tictactoe[1][1]

We call the variable name and the we use one square box each to house the row and column position.

Which part of the packet contains the sequencing information that's used by TCP to reassemble packets

Answers

Answer:

During the TCP startup and teardown sequence, a "phantom byte" causes the sequence number and acknowledgment number fields to increment by 1 even though no data is exchanged. This phantom byte can be confusing when you have just learned that the sequence number field increments only when data is sent.

Explanation:

what is the software component of multimedia

Answers

The various components of multimedia are Text, Audio, Graphics, Video and Animation. All these components work together to represent information in an effective and easy manner.

When a collection of honeypots connects several honeypot systems on a subnet, it may be called a(n) honeynet

Answers

Answer:

The given statement is true.

Explanation:

The honeynet is indeed a decoy network comprising a honey trap or even more. It appears to be a real network with multiple systems but is housed on one or a few servers, each of them together in one setting, which is why it is termed a honeynet when more than one honeypot is linked to an amount of honey pot system on one subnet. In the IDSs (Intrusion Detection Systems), a padded cell system has been used which is like a honeycomb.

#include

int main()
{
char ch;
printf("Enter any letter");
ch=getch
();
printf("\nYou Pressed %c",ch);

return 0;
}
whats the error not giving the correct output

Answers

Answer:

#include<studio.h>

#include<conio.h>

void main()

{

char ch;

printf("Enter any letter");

scanf("%c",&ch);

MyProgramming Lab

It needs to be as simple as possible. Each question is slightly different.

1. An arithmetic progression is a sequence of numbers in which the distance (or difference) between any two successive numbers is the same. This in the sequence 1, 3, 5, 7, ..., the distance is 2 while in the sequence 6, 12, 18, 24, ..., the distance is 6.

Given the positive integer distance and the non-negative integer n, create a list consisting of the arithmetic progression between (and including) 1 and n with a distance of distance. For example, if distance is 2 and n is 8, the list would be [1, 3, 5, 7].

Associate the list with the variable arith_prog.

2.

An arithmetic progression is a sequence of numbers in which the distance (or difference) between any two successive numbers if the same. This in the sequence 1, 3, 5, 7, ..., the distance is 2 while in the sequence 6, 12, 18, 24, ..., the distance is 6.

Given the positive integer distance and the integers m and n, create a list consisting of the arithmetic progression between (and including) m and n with a distance of distance (if m > n, the list should be empty.) For example, if distance is 2, m is 5, and n is 12, the list would be [5, 7, 9, 11].

Associate the list with the variable arith_prog.

3.

A geometric progression is a sequence of numbers in which each value (after the first) is obtained by multiplying the previous value in the sequence by a fixed value called the common ratio. For example the sequence 3, 12, 48, 192, ... is a geometric progression in which the common ratio is 4.

Given the positive integer ratio greater than 1, and the non-negative integer n, create a list consisting of the geometric progression of numbers between (and including) 1 and n with a common ratio of ratio. For example, if ratio is 2 and n is 8, the list would be [1, 2, 4, 8].

Associate the list with the variable geom_prog.

Answers

Answer:

The program in Python is as follows:

#1

d = int(input("distance: "))

n = int(input("n: "))

arith_prog = []

for i in range(1,n+1,d):

   arith_prog.append(i)

print(arith_prog)

#2

d = int(input("distance: "))

m = int(input("m: "))

n = int(input("n: "))

arith_prog = []

for i in range(m,n+1,d):

   arith_prog.append(i)

print(arith_prog)

#3

r = int(input("ratio: "))

n = int(input("n: "))

geom_prog = []

m = 1

count = 0

while(m<n):

   m = r**count

   geom_prog.append(m)

   count+=1

print(geom_prog)

Explanation:

#Program 1 begins here

This gets input for distance

d = int(input("distance: "))

This gets input for n

n = int(input("n: "))

This initializes the list, arith_prog

arith_prog = []

This iterates from 1 to n (inclusive) with an increment of d

for i in range(1,n+1,d):

This appends the elements of the progression to the list

   arith_prog.append(i)

This prints the list

print(arith_prog)

#Program 2 begins here

This gets input for distance

d = int(input("distance: "))

This gets input for m

m = int(input("m: "))

This gets input for n

n = int(input("n: "))

This initializes the list, arith_prog

arith_prog = []

This iterates from m to n (inclusive) with an increment of d

for i in range(m,n+1,d):

This appends the elements of the progression to the list

   arith_prog.append(i)

This prints the list

print(arith_prog)

#Program 3 begins here

This gets input for ratio

r = int(input("ratio: "))

This gets input for n

n = int(input("n: "))

This initializes the list, geom_prog

geom_prog = []

This initializes the element of the progression to 1

m = 1

Initialize count to 0

count = 0

This is repeated until the progression element is n

while(m<n):

Generate progression element

   m = r**count

Append element to list

   geom_prog.append(m)

Increase count by 1

   count+=1

This prints the list

print(geom_prog)

What will the following code display?


A) 6

B) 0

C) 3

D) 0

1

2

Answers

Answer:

Answer is C) 3

Explanation:

fill in the blank figuring out what type of garden you want to grow is the ____step according to the instructions in how to grow a school garden

Answers

Answer:

First.

Explanation:

How to grow a school garden is an illustrative guide that explains to students the step by step process for growing a school garden.

According to the instructions in how to grow a school garden, the first and most important step is figuring out what type of garden you want to grow. At this step, a student should have a good understanding of the type of garden he or she wants to grow.

Thus, this step answers the question of "what am I growing in the garden?"

your organization has multiple remote offices. the users at the remote office often remotely connect to the application servers. which of the protocols should you enforce for encrypted communicationa

Answers

Answer:

RDP

SSH

Explanation:

RDP and SSH can both be used for remote encrypted communication. RDP protocol( called remote desktop protocol) is owned by Microsoft. It allows it's user access to the network through a GUI RDP software that allows you to connect to another computer on the network, the client server. RDPs operate over encrypted channels and is therefore secure.

SSH(called secure shell protocol) is used on Unix like OS systems to connect over unsecured network. SSH uses cryptographic encryption that increases security for it's client-server architecture. It's an improved version of RSH and Telnet which didn't make use of encryption when sending data over the network.


Write a short note on Computer
impact on
our society?​

Answers

well not a note but here are some few points

Explanation:

1 Computers can have the huge impact on employment of people like job and other stuff.

2 lots of human can be jobless or unemployed

3 it can cuz impact on the health of peoples

4 it also can make us lazy and and lack of self knowledge

Answer:

Everybody knows that the computer age is here, and most people use the computer. Science and technology development has a direct impact both on our everyday life and on our social lives. In seconds, computer technology has enabled communication between the two parts of the world. In one part of the world, you may see the transactions while in the other part. The development of computers is one of the 20th century's greatest scientific achievements.

Explanation:

Positive Impact of Computer:-

The work can be done very quickly.You can store more information in a small space.Multitasking and data multimedia capacity.Access to data is easy.

Negative Impact of Computer:-

Very costly.Accidents.Pirating data. Enhanced joblessness.Sometimes enormous data and information can be lost.Computer technology is changing rapidly.Distribution of services.Computing and computer analphabetism.

which advanced boot option starts windows, but loads only the drivers necessary for basic functionality

Answers

Answer:

The correct answer is: The Safe Mode

Explanation:

Safe Mode is an advanced boot option available in Windows. It is of two categories:

Safe Mode  and Safe Mode with Networking (this option allows inter and intra network conectivity)

It is useful for troubleshooting a windows operating system to find out why it is dysfunctional.

It can be activated by pressing the F8 key as the Windows Operting system boots up, but not after.

Cheers!

The logical structure in which one instruction occurs after another with no branching is a ____________.

Answers

Answer:

sequence

Explanation:

The logical structure in which one instruction occurs after another with no branching is a sequence.

In Python, to assign a value to a variable, an equal sign must follow the variable name.

True

False

Answers

ITSSSSSSSSSSSSSSSSSSS true

to which category of software does Microsoft Works belong
a) custom-written
b) customized
c) integrated
d) special purpose ​

Answers

Answer:

c) Integrated

Explanation:

Integrated software are packages that has the functional capacity to perform the several tasks commonly performed by more than one productivity software application, such that those functions and capabilities are integrated into a single application, thereby making it possible for users to carry out required computer tasks, at a lower cost

Examples of integrated software include Microsoft Works, which includes a Word processing, spreadsheet, and database capabilities combined into one application

give the difference between functional and functional tools in the middle of to the circle give importance​

Answers

Answer:

hakkuna matata is the radious of a circle

In a _____ cloud, a participating organization purchases and maintains the software and infrastructure itself.

Answers

Answer:

"Private" is the right solution.

Explanation:

Application servers supplied sometimes over the World wide web or through a personal corporate network as well as to chosen customers rather than the community benefit of the entire, is termed as the private cloud.It provides companies with the advantages of a cloud environment that include self-checkout, adaptability as well as flexibility.


SOMEONE PLEASE HELP ME DUE IS IN 30 MINUTES!!!⚠️⚠️⚠️⚠️

~WAP to accept a number and display the square of the number using SUB END SUB​

Answers

Answer:

Display square root of an input number

REM PROGRAM TO DISPLAY SQUARE ROOT OF AN INPUT NUMBER. INPUT “ENTER ANY NUMBER”; N. S = N ^ (1 / 2) ...

DECLARE SUB SQROOT (N) INPUT “ENTER ANY NUMBER”; N. ...

SUB SQROOT (N) S = N ^ (1 / 2) ...

DECLARE FUNCTION SQROOT (N) INPUT “ENTER ANY NUMBER”; N. ...

FUNCTION SQROOT (N) SQ= N ^ (1 / 2)

Explanation:

hope this helps u

Write a program, which will take 20, inputs from the user and find how many
odd and even numbers are there.

Pseudocode & Python

Answers

Answer:

user_input = [int(input()) for i in range(20)]

even = []

odd = []

for i in user_input:

if i%2:

even.append(i)

else:

odd.append(i)

print("odd : ", len(odd), "even : ", len(even))

Explanation:

The above code is written in python :

Using a list comprehension we obtain a list of 20 values from the user and store in the variable user_input.

Two empty list are defined, even and odd which is created to store even and odd values.

A for loop is used to evaluate through the numbers in user_input. Even values leave no remainder when Divided by 2 and are appended to the even list while those those leave a raunder are automatically odd values. The elements each list are counted using the len function and are displayed using the print statement.

We made a distinction between the forwarding function and the routing function performed in the network layer. What are the key differences between routing and forwarding

Answers

Answer: forwarding: move packets from router's input to appropriate router output

routing: determine route taken by packets from source to destination

Explanation:

The network layer refers to where connections take place in the internet communication process by sending packets of data between different networks.

The distinction between the forwarding function and the routing function performed in the network layer is that the forwarding function move packets from the input of the router to the appropriate router output while the routing function:m helps in knowing the routee taken by packets from the source to destination.

disadvantages of computer. ​

Answers

Answer:You cant carry it around like a phone

Explanation:

You're the administrator for a large bottling company. At the end of each month, you routinely view all logs and look for discrepancies. This month, your email system error reports a large number of unsuccessful attempts to log on. Its apparent that the mail server is being targeted. Which type of attack is most likely occurring

Answers

Answer:

It seems as though it would be a DDoS attack.

Explanation:

The characteristics are as follows:

A slow down of operations and attempting to get access into said service.

In design and implementation of any _____ reasoning application, there are 4 Rs involved: retrieve, reuse, revise, and retain.

Answers

Answer:

case-based.

Explanation:

A software can be defined as a set of executable instructions (codes) or collection of data that is used typically to instruct a computer on how to perform a specific task and solve a particular problem.

Simply stated, it's a computer program or application that comprises of sets of code for performing specific tasks on the system.

A software development life cycle (SDLC) can be defined as a strategic process or methodology that defines the key steps or stages for creating and implementing high quality software applications. There are seven (7) main stages in the creation of a software and these are;

1. Planning.

2. Analysis.

3. Design.

4. Development (coding).

5. Testing.

6. Implementation and execution.

7. Maintenance.

A case-based reasoning application refers to a knowledge-based system that is designed and developed to use previous case scenarios (similar past problems) to interprete or proffer a solution to a problem.

In design and implementation of any case-based reasoning application, there are four (4) Rs involved: retrieve, reuse, revise, and retain.

what is the best college in texas for cyber security

Answers

Answer:

Cybersecurity education in Texas There’s no doubt that cybersecurity education in Texas is in a league of its own. Out of all of the Lone Star State’s universities, the University of Texas at San Antonio is the number one choice for many budding cybersecurity professionals.

¿Si tengo un disco de 1Tb, y en el tengo almacenado lo siguiente:
a) 300 videos de 126GB en total
b) 1376 archivos de office que cada uno pesa 117kb.
c) 3000 mp3 de 3.8mb cada uno.
d) 4Gb ocupados en el sistema operativo.
¿Cuánto espacio me sobre en el disco duro?

Answers

Answer:

Espacio a la izquierda = 858,8439008 Gb

Explanation:

Dados los siguientes datos;

Tamaño del disco duro = 1 Tb

Vídeos = 126 Gb

Archivos de Office = 1376 * 117 Kb = 160992 Kb

Mp3 = 3000 * 3.8 mb = 11400 Mb

Sistema operativo (OS) = 4 Gb

Conversión:

En primer lugar, convertiríamos el tamaño del archivo en kilobytes a megabytes.

1000 Kb = 1 Mb

160992 Kb = 160992/1000 = 160.992 Mb

Memoria total (Mb) = 11400 + 160,992

Memoria total (Mb) = 11560.992 Mb

A continuación, convertiríamos el tamaño del archivo en megabytes a gigabytes;

1000 Mb = 1 Gb

11560.992 Mb = 11560.992/1000 = 11.560992 Gb

Por último, sumaríamos todos los tamaños de archivo en gigabytes;

Espacio total (memoria) utilizado = 126 + 11.560992 + 4

Espacio total (memoria) utilizado = 141,560992 Gb

Conversión:

1000 Gb = 1 Tb

Espacio restante = tamaño del disco duro - memoria total utilizada

Espacio a la izquierda = 1000 - 141.560992

Espacio a la izquierda = 858,8439008 Gb

Nota:

Kb significa kilobyte. Mb significa megabyte. Gb significa gigabyte. Tb significa terabyte.

What is the output of this code?
num-7
if num > 3:
print("3")
if num < 5:
print("5")
if num --7:
print("7")

Answers

Answer:

The output is:

3

7

Explanation:

Given

The code segment

Required

The output

The given code segment has 3 independent if statements; meaning that, each of the if conditions will be tested and executed accordingly

This line initializes num to 7

num=7

This checks if  num is greater tha 3; If yes, "3" is printed

if num > 3:

   print("3")

The above condition is true; so, "3" will be printed

This checks if  num is less than 5; If yes, "5" is printed

if num < 5:

   print("5")

The above condition is false; so, "5" will not be printed

This checks if  num equals 5; If yes, "7" is printed

if num ==7:

   print("7")

The above condition is true; so, "7" will be printed

So, the output is:

3

7

Select all that apply: Our primary objectives in functional programming are: Group of answer choices Functions should be as pure as possible following a pattern of Input->Processing->Output To model algorithms in a state-machine like format Removing state from programming Modeling data into a fact-base to be queried Raising our abstraction towards math Code free of side effects Modeling data into classes/objects that intercommunicate to solve software issues

Answers

Answer:

Functions should be as pure as possible following a pattern of Input->Processing->Output

To model algorithms in a state-machine like format

Code free of side effects

Explanation:

Functional programming is a popular concept in most popular programming languages such as Lisp that makes use of functions in separating code that aims to define and solve a particular problem which is part of a bigger problem. Functional programming focuses on what to solve, ie what is the problem rather than how do we solve it. It divides up code in meaningful blocks that makes it a lot more understandable, allowing big problems to be solved in tiny bits and not an overwhelming whole. Functional programming adopts the state-machine like format as it makes use of input and alters state as necessary(not hard coded). It also removes side effects issues that may be experienced when a function affects or mutates variables(global variables) that may be outside its block.

Other Questions
what type of literary device is " Wilson and I are different species: hes an early bird and I am a night owl. The problem is if I move him to his own cage, who will I get to clean up the droppings? (Adapted from T.V.s House.)" provide explanation please need this ASAP The valid call to the function installApplication isvoid main( ) {// call the functioninstallApplication}void installApplication(char appInitial, int appVersion) { // rest of function not important} Select one:A.int x =installApplication(A, 1);B.installApplication(A, 1);C.int x= installApplication( );D.installApplication(2 , 1); what is the meaning of "Ti amo"? A TV satellite dish is designed to receive radio waves of wavelength0.0644 meters. What is the frequency of the waves it receives? _______GHzGive your answer in gigahertz (GHz). 1 GHz = 10^9 Hz.Give your answer to the nearest tenth of a GHz (one place after the decimal). Just enter the number; do NOT use scientific notation. Which of the following pairs lists a substance that can neutralize Ca(OH)2 and the salt that would be produced from the reaction? HCl and CaCl2HClO and CaHClOH2O and Ca(OH)3H3PO4 and Ca(PO3)2 Atoms are:O A. One of the 4 elements that matter is composed of.B. Connected by bonds to form compounds.OC. The basic building blocks of matter.O D. Heterogeneous and refer to color, texture, and appearance.Reset Selection In the image below, what molecule is being released by cellular respirationand used in photosynthesis?A. 02B. CO2C. H20D. C6H1206 Surface Area of PrismsCan someone show me how to solve and also what the formula is. Please! AB = 20 cm, mA = 30, and mC = 45. Express the number of centimeters in the length of BC in simplest radical form. An open-market sale of securities by the Fed results in ________ in reserves and ________ in the supply of money. determine lcm and HCF of 24 and 26 using prime factors One circle has a circumference of 12 cm. Another circle has a circumference of 32 cm. What is the ratio of the radius of the smaller circle to the radius of the larger circle?Options: A: 3:8B: 8:3C: 1:3D: 3:1 If a^2 -b^2 =12 and a-b=4 what is the bay of a +b Type your answer and then click or tap Done.Now look at the combined sentence. Which portion of the combined sentence is the compound subject?Sir Edmund and his son, Cecil, were explorers. Hum1. Define the followingy populationAA population is a grousame species locatedtime.i settlement Fern, Inc., Ivy, Inc., and Jeremy formed a general partnership. Fern owns a 50% interest, and Ivy and Jeremy both own 25% interests. Fern, Inc. files its tax return on an October 31 year-end; Ivy, Inc., files with a May 31 year-end, and Jeremy is a calendar year taxpayer. Which of the following statements is true regarding the taxable year the partnership can choose?A) The partnership must choose the calendar year because it has no principal partners. B) The partnership must choose an October year-end because Fern, Inc., is a principal partner. C) The partnership can request permission from the IRS to use a January 31 fiscal year under 444. D) The partnership must use the "least aggregate deferral" method to determine its "required" taxable year. E) None of the above items are true. an experiment was carried out and H2SO4 was collected resulting in a 92.0% yield. What mass of H2SO4 was collected from the experiment? After doing the activity, give your own definition of culture, society and politics,1.Culture =2.Society =3.Politics = L. Read the following sentences. Write whether they show problem or solution. Write your answer on the blank. 1. Some people are not disposing their garbage properly. 2. The local government issued an order of dredging the rivers. 3. Electric bill is so high that many families find it hard to pay. 4. Turn off lights and appliances when not in used. 5. Many forests are denuded because of illegal logging. 6. Students can not have an access of the internet. 7. The children are having hard time in studying because of gadgets. 8. Anna left the room messy. 9. Father raises animals in the backyard. 10. There are many out of school youths engaged in illegal used of drugs. Suppose y varies inversely with x, and y = 18 when x = 12. What is the value of x when y = 24? NO LINKS OR ANSWERING YOU DON'T KNOW? a. 24b. 9c. 12d. 18