#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;
}
|