quip
02-08-2004, 10:28 PM
I am trying to learn some C++. I am inputting some data, using a character array. Is there any way to input data into a character array with whitespace, i.e. for a name put in "John Doe"? Currently, my program takes the input and puts John in the first variable and Doe in the second, before the prompt even comes up. Here's the snippet of the code:
int print_to_screen()
{
while ((counter <= user_number))
{
std::cout << entry[counter].name << "\n";
std::cout << entry[counter].address << "\n";
std::cout << entry[counter].city << "\n";
std::cout << entry[counter].state << "\n";
std::cout << entry[counter].zip << "\n";
std::cout << "\n";
++counter;
}
counter = 0; //reset the counter
return(0);
}
int print_to_screen()
{
while ((counter <= user_number))
{
std::cout << entry[counter].name << "\n";
std::cout << entry[counter].address << "\n";
std::cout << entry[counter].city << "\n";
std::cout << entry[counter].state << "\n";
std::cout << entry[counter].zip << "\n";
std::cout << "\n";
++counter;
}
counter = 0; //reset the counter
return(0);
}