The following is my code:
// Program to print the initials of a name
#include <iostream>
using namespace std;
int main() {
char first, last;
cout<<"Enter first and last name: ";
first = cin.get();
cin.ignore(10000,' ');
last = cin.get();
cout<<first<<" "<<last;
return 0;
}
I was looking for a way to specify more than one delimiter as the second parameter of cin.ignore(), e.g. cin.ignore(10000,'\n' or ' '). Is there a way to achieve this?