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
Question #1
arlik [135]

Answer:

Pseudocode and flowchart.

Explanation:

I just got it correct.

8 0
3 years ago
You have a desktop computer that supports both IEEE 1394 and USB 2.0. You are purchasing some devices that will connect to these
zimovet [89]

Answer:

IEEE 1394 supports more devices on a single bus

Explanation:

What this means is that IEEE 1394 provides a single plug-and-socket connection on which up to 63 devices can be attached with data transfer speeds up to 400 Mbps (megabit s per second). The standard describes a serial bus( A shared channel that transmits data one bit after the other over a single wire or fiber) or pathway between one or more peripheral devices and your computer's microprocessor .

7 0
3 years ago
Which process helps to find files on your computer easily?
vekshin1

Answer:

1. a 2. a or c

Explanation:

6 0
3 years ago
Read 2 more answers
PLS HELP ME I HAVE NO TIME
melisa1 [442]
Please Help! Unit 6: Lesson 1 - Coding Activity 2
Instructions: Hemachandra numbers (more commonly known as Fibonacci numbers) are found by starting with two numbers then finding the next number by adding the previous two numbers together. The most common starting numbers are 0 and 1 giving the numbers 0, 1, 1, 2, 3, 5...
The main method from this class contains code which is intended to fill an array of length 10 with these Hemachandra numbers, then print the value of the number in the array at the index entered by the user. For example if the user inputs 3 then the program should output 2, while if the user inputs 6 then the program should output 8. Debug this code so it works as intended.

The Code Given:

import java.util.Scanner;

public class U6_L1_Activity_Two{
public static void main(String[] args){
int[h] = new int[10];
0 = h[0];
1 = h[1];
h[2] = h[0] + h[1];
h[3] = h[1] + h[2];
h[4] = h[2] + h[3];
h[5] = h[3] + h[4];
h[6] = h[4] + h[5];
h[7] = h[5] + h[6];
h[8] = h[6] + h[7]
h[9] = h[7] + h[8];
h[10] = h[8] + h[9];
Scanner scan = new Scanner(System.in);
int i = scan.nextInt();
if (i >= 0 && i < 10)
System.out.println(h(i));
}
}
6 0
3 years ago
Does anyone have any suggestions on how to teach my grandma to use her tablet? She always complains when it says not responding.
spayn [35]
Try to explain slowly and with patience it takes time because she isn't used to it
8 0
3 years ago
Other questions:
  • What is a Windows feature that allows you to temporarily store text?
    5·1 answer
  • In two to three sentences, describe one advanced search strategy and how it is useful.
    11·1 answer
  • Samantha is in the beginning stages of OOP program development. What are the five steps she must follow for creating an OOP prog
    6·2 answers
  • Erik is the president and owner of Watch Out, a local website development company that helps clients create and build unique web
    15·1 answer
  • ____ is a technique for confirming that q received packet or frame is likely to match what was sent
    15·1 answer
  • A computer with the ability to store instructions and do the job when requested by the operator, this type of computer had a spe
    12·1 answer
  • Which tab on the ribbon in the folder window allows users to change how the contents of the folder are being shown?
    11·1 answer
  • What is a best practice when approaching an automation effort?
    6·1 answer
  • Q) Look at the code and determine the output
    14·1 answer
  • Cite some improved technology this 2021?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!