#include<stidio.h>
#define MSG "You must have many talents. Tell me something."
#define LIM 5
#define LINELEN 81
int main (void)
{
char name[LINELEN];
char talents[LINELEN]; //這兩個為字符變量數組的定義,前面的const就是一種定義模式,放在這個位置與首位置意思一樣,分號不可以少
int i;
const char m1[40] = "Limit yourself to one line's worth";
const char m2[ ] = "If you can't think of anything fake it";
const char *m3 = "\nEnough about me-what's your name?"; //指針的方法,這樣寫相當于首字母的地址被表示進行就可以了
const char *mytal[LIM] = {
"Adding number swiftly",
"Multiply accurately",
"Stashing date",
"Following instructions to the letter",
"Understanding the C language",
}; //與for語句的配合注意
printf ("Hi! I'm Clyde the Computer." "I have many talents");
printf ("Let me tell your some of them.\n");
puts ("What were they? Ah,yes,here's a partial list.");
for (i=0; i
puts(mytal[i]);
puts(m3); //輸入
gets(name); //輸出
prinf ("Well,%s,%s\n",name, MSG);
printf ("%s\n%s\n",m1,m2);
gets(talents);
puts("Let's see if l've got that list:");
puts(talents);
printf("Thanks for the information.%s\n",name);
return 0;
}
|