I did a quick search and didn't find this question on the forums. If it's already been asked and you have the link, could you please post it? Thanks in advanced.
Anyway, I'd like to know if it's possible to take user input and have it stream into a char array. Usually when you press space, it only gets up to where you pressed space, and a weird glitch happens where the program skips a few other instances where the user has to input information. Here's some code:
void Make(){//this is a function of a program that lets users make lists//
int entry_num = 0;
cout << "\n\tEnter the name of the list:\n\t\t";
cin >> Entry[entry_num].Name;
int x = 0;//this represents the number of the list item we're dealing with.
while (x < 10){
cout << "\n\tEnter item " << (x + 1) << " below:\n\n\t\t" << (x + 1) << ". "; /*the x + 1 is because 0 represents the first item,
but the user will want to count from 1*/
cin >> Entry[entry_num].ListItem[x].Value;//user enters the first item here
cout << "\n\tEnter any extra information about the item (limit 100 characters):\n\n\t";
getline(cin, Entry[entry_num].ListItem[x].SubItem.Value);
x++;
entry_num++;
}//end of while//
}
About the skipping, it happens because operator>> (the extraction operator) leaves the newline character in the buffer after extracting the value (in your case line #15). Use cin.ignore() or one of its variants to get rid of the newline char before extracting again.