Hello. I have an integer that the user enters. I need each digit of the integer to be set as an element of an array. the integer could also be entered as an array, but I need the user not to have to enter each element and press ENTER. Any help would be appreciated greatly. Thank you!
Hello. I did some browsing through the C++ reference and found this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
// istream::ignore example
#include <iostream> // std::cin, std::cout
#include <cstdlib>
int main () {
char first, last;
std::cout << "Please, enter your first name followed by your surname: ";
first = std::cin.get(); // get one character
std::cin.ignore(256,' '); // ignore until space
last = std::cin.get(); // get one character
std::cout << "Your initials are " << first << last << '\n';
system ("PAUSE") ;
return 0;
}
I am going to use this format to turn each digit to an element of an array. All I need to know is how to get the next letter after the first and so on. (line 10 only gets the first character) Thank you!