for some reason my code is compiling but not recognizing the if statements at all? I put printf statements to find out the where the problem was but its really just skipping past all the printf statements and reading input straight into main. how do I fix this
heres my code in case you need it
Code:
char *consider(void){
char *clothing;
printf("what are you considering: ");
clothing=readToken(stdin);
if (strcmp(clothing, "shirt\n")==0) printf("what kind of shirt: ");
if (strcmp(clothing, "pants\n")==0) printf("what kind of pants: ");
if (strcmp(clothing, "other\n")==0) printf("What kind of stuff: ");
return clothing;
}
char *kind(char *clothing)
{
char *kindofclothes;
printf("what kind?: \n");
kindofclothes=readToken(stdin);
if (strcmp(clothing,"shirt")==0)
{
if (strcmp(kindofclothes, "tshirt")==0)
if (strcmp(kindofclothes, "sweatshirt")==0)
if (strcmp(kindofclothes, "nice")==0)
return kindofclothes;
} return kindofclothes;
if (strcmp(clothing,"pants")==0)
{
if (strcmp(kindofclothes, "jeans")==0)
if (strcmp(kindofclothes, "other")==0)
return kindofclothes;
} return kindofclothes;
if (strcmp(clothing,"other")==0)
{
if (strcmp(kindofclothes, "socks")==0)
if (strcmp(kindofclothes, "other")==0)
return kindofclothes;
} return kindofclothes;
}
int main()
{
char *clothes;
clothes=consider();
char *Watkind;
Watkind=kind(clothes);
printf("you chose %s\n", Watkind);
return 0;
}