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
snow_lady [41]
2 years ago
15

Write a loop that reads positive integers from console input, printing out those values that are even, separating them with spac

es, and that terminates when it reads an integer that is not positive. Declare any variables that are needed.
Computers and Technology
1 answer:
AfilCa [17]2 years ago
3 0

#include <iostream>

#include <vector>

std::vector<int> v;

int main(int argc, char* argv[]) {

   while(1) {

   int temp;

   std::cout << "\nEnter a number: ";std::cin>>temp;

   

   if(temp<0) {

       std::cout << "\nEven number(s) is/are:\n---------------------\n";

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

           if(v.at(i)%2==0) std::cout << v[i] << " ";

           else continue;

       }

       std::cout << std::endl;

       break;

   }else {

       v.push_back(temp);

   }

}

   return 0;

}

You might be interested in
From the philosophical standpoint, especially in the discussion of moral philosophy or ethics, why do we consider “murder” or “k
wlad13 [49]

Explanation:

Morality is a set of values ​​and habits that a society acquires over time and can be categorized as good and bad values, right and wrong, justice and crime. Ethics is defined as the study of morals, the practical application of moral behaviors defined by society.

Therefore, the concept of "murder" or "killing" is seen as an immoral act by the vast majority of society around the world, strengthened by the set of moral conduct common to all human beings, which are the Articles on the Universal Declaration of Human Rights. Human Rights, which is an official document of the UN, which contains several universair and analytical rules on the rights of every individual, such as the right to life, security, freedom, etc.

7 0
3 years ago
Why are large commercial companies interested in developing mobile apps for smartphones?
loris [4]
Because they can make a lot of money if they create a popular application.
7 0
3 years ago
Why won't it let me submit my question
iVinArrow [24]

Answer:

what was the question?

Explanation:

8 0
3 years ago
When a user modifies the fonts in a message and immediately sees the effect of a font change without actually
MaRussiya [10]

Answer:

Font view

Explanation:

4 0
3 years ago
Read 2 more answers
5. What will be displayed when this program finishes running?
Vika [28.1K]

Answer:5 i think im not sure though

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • Which view is used to allow a publisher to view facing pages of a publication at the same time?  NormalMaster PageTwo-Page Sprea
    9·1 answer
  • This is the formula for the future worth of an investment over time with consistent additional monthly payments and a steady rat
    10·1 answer
  • When you move a paragraph in a document that includes text with a footnote, what happens to the footnote reference?
    7·2 answers
  • The ________ is the heart of the operating system and controls its most critical processes.
    9·1 answer
  • Helpppp plsssss!!!<br><br>thanks.
    7·1 answer
  • If a computer truncatesall numbers to two decimal places, compute the error forthe following: 23.345+222.34911)0.12)0.01413)0.14
    15·1 answer
  • What is the output of the code?
    15·1 answer
  • A student is having trouble finding enough time in his busy schedule to work on his school science project. He has a demanding s
    5·2 answers
  • Questlon 5 of 25
    5·1 answer
  • Fiscal policy includes each of the following except? 1) the money supply. 2) taxes. 3) government spending. 4) the automatic sta
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!