I'm trying to get string input from the keyboard for my assignment. For my assignment the user can input 1 of 3 things (there's no menu system to determine which - i have to be able to tell what they did and respond.
The user can input:
1. a float number (75.6)
2. a letter grade, or other letter representing something (A+, DNF, etc.)
3. up to 5 ints (could be: "70 80 60 30 100" or "70 80"
This is the code I have currently but it does not work, has it forces the user to input 5 things, regardless of whether or not they press enter: I need to be able to input a string, and then analyze that string to determine what sort of input they did, and if necessary pull the numbers from the string.
Code:
int main()
{
char mark1[4] = "", mark2[4] = "", mark3[4] = "", mark4[4] = "", mark5[4] = "";
cout << "input the students mark(s)";
cin >> mark1 >> mark2 >> mark3 >> mark4 >> mark5;
cout << "numbers are:" << mark1 << mark2; // this is just for testing
return 0;
}