I am slightly confused as to how cin.ignore works. I'll try to make this short. I need to write a program where the user inputs a bunch of data in 1 string, for example : 46728s1000 2750.55John Brown
I need to extract the different parts of that input. I need to extract the first 5 digits, the 's', the 1000, the 2750.55 and John Brown.
Any help would be much appreciated 8)
I need to extract the different parts of that input. I need to extract the first 5 digits, the 's', the 1000, the 2750.55 and John Brown.
Code:
int getInformation (bool isFirstInput)
{ int accountNumber;
char accountType;
int minBalance;
double oldBalance;
string firstNamelastName;
const string welcomeMessage = "Welcome to Brandon Lashmet's payroll program\n. Please enter account number, account type, minimum balance, a space, old balance, and first and last name of account owner.";
if (isFirstInput==true)
{
cout<<welcomeMessage;
}
else
{
cout<< "Thank you. Please enter next user's information";
}
cin>> accountNumber;
cin.ignore(5);
cin>> accountType;
cin.ignore(6) ;
cin>> minBalance;
cin.ignore(11);
cin>> oldBalance;
getline(cin, firstNamelastName);
}