Hello all.
I have been skimming and searching but dont know how to word the search just right to find what I need to know. I have written simple stuff with the help of tutorials like weight conversion or loops counting up to a set number. Nothing amazing. The other day I found out how to input and print a string rather than a single text character which i though was bad ass. I even got it to read multiple strings on a single line and found a way to read multiple lines. I can even format it to read both integers and characters on the same line as long as I know the predefined format.
On to my quesation... How do I read multiple lines with both carecters and integers. for instance:
nissan 1996
toyota 1998
or more comples like
nissan gtr 1996
toyota markii 1998
I want to use
int year;
char make[10]; maybe need to use char make[10][10]; for an array i would guess.
char model[10]; optional for the extra data
but reproduce what i read in a different order. say...
1996 nissan
1998 toyota
vice the original format.
this is what I have tried.
But this wont let me separate the two into two differnet definded data types. Let alone use printf to display them in reverse order. Any pointers? A short explination would help just as much as the code.Code:scanf("%s %s", &make,&year); //The way I seen to read multiple lines was on here scanf("%[^/t]", %make);