回覆列表
-
1 # rerhg4825
-
2 # 泰迪神蹟
#include
void main()
{
char name[20];
printf("請輸入你的姓名:");
gets(name);
printf("你輸入的姓名是:");
puts(name);
}
#include
void main()
{
char name[20];
printf("請輸入你的姓名:");
gets(name);
printf("你輸入的姓名是:");
puts(name);
}
#include <stdio.h>#include <stdlib.h>int main(void){FILE *fp=fopen("data.txt","r");if (!fp){fp=fopen("data.txt","w");printf("請輸入姓名:");char *name;scanf("%s",name);printf("請輸入學號:");char *num;scanf("%s",num);fprintf("%s %s",name,num);fclose(fp);return 0;}char *name,*num;fscanf("%s %s",name,num);fclose(fp);printf("姓名為:%s\n學號為:%s",name,num);return 0;}