I though you knew m4ster r0shi that we don't like full solutions around these parts. Especially those without comments.
You can use getline or cin.getline to get more than just whole lines. The third parameter should you define it is a delimiting character. Set it to whatever you want, and the getline will stop there.
To separate them, then <ctype> has a nifty function known as isdigit(). If all the characters are digits (save the first character which may be a minus sign, check that on the first iteration of your loop), then it's an integer. Else, not.
I guess m4ster r0shi gave out a very long code solution, but this should clear up how to do it besides Ctrl+C and Ctrl+P.
First of all i want to thank m4ster r0shi for his full code but maybe i explained things wrong. I can still adjust m4ster r0shi's code but i'm sure there is an elegant way to do what i want.
Below is my input;
11 7 4 -10 -1
A E H W
4 -1 -2 -3
-1 5 0 -3
-2 0 8 -2
-3 -3 -2 11
HAAEEWWHEEA
HHAEWHA
Notice that each line holds parameters for doing something with the 2 seperate strings below. Each line has different number of variables. i.e, first line has 5 integers, 2. line has 4 characters, last 2 lines have 2 strings.
So far, i'm doing the following;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
infile >> length_of_M >> length_of_N>> s >> gap_opening_penalty>>gap_extension_penalty;
getline(cin,alphabet);// get the letters
alphabet.erase( remove( alphabet.begin(), alphabet.end(), ' ' ), alphabet.end() );//remove spaces
sstable=newint[s];// form up a SxS matrix
for(int i=0;i<s;i++)
*(sstable+i)=newint[s];// error here for some reason
// read S lines in to sstable array
getline(cin,m);// read string M
getline(cin,n);// read string N
infile.close();