If I wanted to use a loop with scanf(), what should I use ?
Thank You
If I wanted to use a loop with scanf(), what should I use ?
Thank You
That depends on what you wanted to do... AFAIK, your choice of loop should be dictated by how you want it to execute, not the fact that you're using scanf
-Govtcheez
[email protected]
What I wanted to was to type in a name
James Bellweather
Result would be
Bellweather, J.
I need to do this with 10 names. I have 75 of the code done.
The code is
#include <stdio.h>
int main()
{
int c;
char first[8];
char last [9];
char middle[11];
{
printf("\nINPUT\n");
/* Here is where the loop will be going */
{
scanf(" %s,", first);
scanf(" %s,", last);
scanf("//");
}
printf("\nOUTPUT:\n");
printf("%s, %s\n", last, first);
}
return 0;
}
Please Help.
Thank You
Well, since it's running a predetermined number of times, I'd say to use a for loop:
for (i = 0;i<10;i++)
-Govtcheez
[email protected]