#include <stdio.h>
#include <string.h>
#define N 1000
int main(void)
{
char ch, str[N];
int i = 0;
while(1)
{
ch = getchar();
while(ch != EOF)
{
str[i] = ch;
i ++;
if(ch == '\n')
break;
ch = getchar();
}
if(ch == EOF)
break;
else if(str[5] == '-')
printf("I am showing help.\n");
else if(str[5] == 'e'||str[5] == 'o')
printf("I am a c89 preprocessor + compiler + linker. I start from \"hello.c\" and end with \"a.exe\".\n");
else if(str[5] == 'c')
printf("I am a c89 preprocessor + compiler. I start from \"hello.c\" and end with \"hello.o\".\n");
else if(str[5] == 'E')
printf("I am a c89 preprocessor. I start from \"hello.c\" and end with \"expanded.c\".\n");
else
{
if(str[14] == 'e')
printf("I am a c99 preprocessor + compiler + linker. I start from \"hello.c\" and end with \"a.exe\".\n");
else if(str[14] == 'c')
printf("I am a c99 preprocessor + compiler. I start from \"hello.c\" and end with \"hello.o\".\n");
else if(str[14] == 'o')
printf("I am a c99 preprocessor. I start from \"hello.c\" and end with \"foobar.c\".\n");
}
i = 0;
}
return 0;
}
这是我写的一段代码!我知道有很多错误!
该学习了。。。