我知道您可以使用 scanf 并获取要在 if 子句中使用的字符,但是,有没有办法用字符串来做到这一点?
例如
printf("enter 'foo' to do 'bar', otherwise enter 'hay' to do 'wire');
scanf("%string", &stringNAME); //this is the part where I have no idea what to do
if (stringNAME == 'foo'){do bar} //here, issues occur with multicharacter character :/
if (stringNAME == 'hay'){do wire}