answersLogoWhite

0

#include<iostream>

#include<sstream>

using namespace std;

int main()

{

std::vector<int> input;

for (size_t index=0; index<4; ++index)

{

cout << "Enter a number: ";

bool valid=false;

while (!valid)

{

string in;

cin >> in;

stringstream ss;

ss << in;

if (!(valid = (ss >> input[loop]))

std::cout << "Invalid input! Try again: ";

}

}

std::cout << "\n\nYou entered the following: ";

for (size_t index=0; index<4; ++index)

cout << input[loop] << ' ';

cout << '\n' << endl;

}

User Avatar

Wiki User

10y ago

What else can I help you with?

Related Questions

What is the code of a c program that will read in a positive integer value and determine If the integer is a prime number and If the integer is a Fibonacci number?

see the program


Write a program to subtract integer y from integer x?

x -=y;


Is -5 a integer?

1 hour ago my c program said no, but now I know 5 actually is an integer!


Write a program to s wap kth and k plus 1th element?

Assuming the elements are integer type... a[k] ^= a[k+1]; a[k+1] ^= a[k]; a[k] ^= a[k+1]; ...but if they are not integer type... temp = a[k]; a[k] = a[k+1]; a[k+1] = temp;


What domestic program consisted of adults who lived and worked with low-income people?

vista


Wrie a program to receive an integer and find its octal equivalant?

Use %o


Different types of elements which require storage during program execution?

Variables, arrays, objects, and pointers are common elements that require storage during program execution. Each of these elements holds data that needs to be accessed or modified during the running of the program.


How would you write a program that read an integer for display each of digit of integer in English?

Use an enum if you are using a c style language. Or a map data structure. Assign each integer an English value and then match it to what the user inputs.


How many missions flew in the Apollo program?

The Apollo program consisted of a total of 17 missions, with 10 crewed missions (Apollo 7-17) and 7 unmanned missions.


How do you Write a C program to reverse an Integer number.?

Reference:cprogramming-bd.com/c_page2.aspx# reverse number


What lists all the integer solutions of the equation x equals 10?

The person or program that solves the equation does.


How do you make a program to check the remainder in gw-basic?

Use the MOD operator to get the remainder of integer division.