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
To join a social network you create an avatar true or false
svp [43]
False because not all social media webstites provide avatars
7 0
3 years ago
Read 2 more answers
You are writing a program that defines a variable within a loop, and then tries to use that variable outside the loop. However,
Law Incorporation [45]

Answer:

The Variable is out of scope

Explanation:

In programming variables exists with scopes This could be local or global. When a variable is declared as a global variable it is available to all methods and procedures in the program. Java programming language as well as C++ and several others use the open and close braces to define the scope in programs. consider the following example

<em>public class ANot {</em>

<em>    public static void main(String[] args) {</em>

<em>        int i = 0;</em>

<em>        while ( i<10){</em>

<em>            int sum = 0;</em>

<em>            sum = sum+i;       </em>

<em>        }</em>

<em>    }</em>

<em>}</em>

In this example, the variable i is global and can be assessed within the while loop but the variable sum is local to the while loop and cannot be assessed outside of it

4 0
2 years ago
Is a procedure to copy one or more files from backup media to the original disk or a replacement disk when data or programs have
Stels [109]
Restore is a procedure to copy one or more files from backup media to the original disk or a replacement disk when data or programs have been erased or destroyed.
4 0
3 years ago
Describe a situation in which you have experienced harm as a consequence of a failure of computer security. Was the failure mali
frutty [35]

Answer: The goals of computer security are to protect computers and users from data theft or loss as well as damage to any part of the computer.

Explanation: Common means of achieving computer security are firewalls, anti-virus software and this can fail due to hardware problems  or   weaknesses that prevent malicious attacks.

To answer this question, think of a time when you experienced any one of these. For example, personally, I was once an unfortunate victim of a general malicious attack that took advantage of a weakness in my anti-virus software. After clicking on a link on a dodgy website, a virus was installed on my computer. My computer finally crashed, without any hope of restarting it. I lost all my data and I had to buy a new computer.  This was a malicious attack.

However, sometimes people can be specifically targeted to steal their data or monitor their activities.  

7 0
2 years ago
The ________ of the operating system enables users to communicate with the computer system. Select one: A. user interface B. mod
Mumz [18]
The user interface of the operating system
8 0
3 years ago
Other questions:
  • ___ refers to all aspects of managing and processing information using computers and computer networks
    13·1 answer
  • Match these items. 1 . Naturalization Act stated that a foreigner had to live in the United States fourteen years to become a ci
    5·1 answer
  • i will be doing an interview to someone so plz comment down below something random and you will automatically enter
    11·1 answer
  • What do developers do to support software products? explain to users which development process model was used to make the produc
    8·1 answer
  • Quinton is having trouble learning Spanish because he keeps reverting back to the grammatical structures of his native English l
    6·1 answer
  • What behaviors are most common in a successful entrepreneurship
    9·1 answer
  • One of the driving forces in operating system evolution is advancement in the underlying hardware technology.
    8·1 answer
  • Write an application that allows a user to enter any number of student quiz scores, as integers, until the user enters 99. If th
    5·1 answer
  • Having data in a column formatted differently based on value is known as
    7·1 answer
  • What computer is designed for particular application​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!