Name: Anonymous 2009-02-25 6:36
Trying to write something to compare names. Check to see which you've entered (one of several 'users') then spout some printf shit or change integers depending on the given name.
Code is
#include <stdio.h>
#include <stdlib.h>
int main ()
{
char whoru[10];
printf( "whoru? namea or nameb? \n" );
fgets( whoru, 10, stdin );
if (
whoru[10] == 'namea'
) printf("A");
else if (
whoru[10] == 'nameb'
) printf("B");
else
printf("Whoru?");
getchar();
return 0;
}
Will take a verbal beating if anyone can help me out.
I'm new + trawling C tuts + google for anything I could find, such as fgets, I might be using it wrong, I do not know.
Code is
#include <stdio.h>
#include <stdlib.h>
int main ()
{
char whoru[10];
printf( "whoru? namea or nameb? \n" );
fgets( whoru, 10, stdin );
if (
whoru[10] == 'namea'
) printf("A");
else if (
whoru[10] == 'nameb'
) printf("B");
else
printf("Whoru?");
getchar();
return 0;
}
Will take a verbal beating if anyone can help me out.
I'm new + trawling C tuts + google for anything I could find, such as fgets, I might be using it wrong, I do not know.