這程式我是用c來寫的
執行之後,按 1 可輸入學生資料
希望按 2 可以從螢幕上看到之前輸入的資料
下面是我的檔案內容,請大家多多幫忙...
#include<stdio.h>
#include<alloc.h>
#include<conio.h>
typedef struct listnode
{
char data;
char name;
char card;
int phont;
char sex;
char height;
char weight;
struct listnode *next;
}Queue;
Queue *front ;
int InserAfter(Queue *head, char name, char card, int phont, char sex,
char height, char weight)
{
Queue *newnode;
newnode=(Queue*)malloc(sizeof(Queue));
if (newnode==NULL)
return(0);
newnode->name = name;
newnode->card = card;
newnode->phont = phont;
newnode->sex = sex;
newnode->height= height;
newnode->weight = weight;
newnode->next = NULL;
while(head->next != NULL) /* 若指到下一個不是 */
head = head->next; /* 把首結點所指到的下一個地方給首結點去指 */
head->next = newnode; /* 新結點的位子給首節點去指 */
return(1); /* 傳回值 1 */
}
void main ( )
{
char name[15];
int phont;
char card[15];
char sex[15];
char height[15];
char weight[15];
int i;
while(i!=3)
{
printf(" 請選擇你要做的項目 : \n");
printf(" 1.輸入學生資料\n");
printf(" 2.顯示學生資料\n");
printf(" 3.嗯..程式作完囉..掰掰..:)\n");
printf(" 請選擇==>");
scanf("%d",&i);
switch (i)
{
case 1: printf("請輸入姓名 => ");
scanf("%s",&name);
printf("請輸入性別 => ");
scanf("%s",&sex);
printf("請輸入身高 => ");
scanf("&s",&height);
printf("請輸入體重 => ");
scanf("&s",&weight);
printf("請輸入電話號碼 => ");
scanf("%d",&phont);
printf("請輸入身份證字號 => ");
scanf("%s",&card);
break;
case 2: break;
case 3: break;
}
}
printf("執行完畢,掰掰...:) \n");
}
--
[1;36m 歡迎大家來看看這個 象迷天堂 ....... [37;40m [0m
[1;35m http://www.taconet.com.tw/~Hsuan [37;40m [0m
[1;34m 內有: 球隊介紹 球員名單 最新戰績 球隊戰歌 [37;40m [0m
[1;33m 昨日戰況 球迷留言 棒球先生 盜帥傳奇 [37;40m [0m
[1;32m 八年賽程 免費資源 搜尋引擎 線上會議 [37;40m [0m
[1;31m 音樂欣賞 精選檔案 球迷討論 [37;40m [0m
--
* Origin: ★ 交通大學資訊科學系 BBS ★ <bbs.cis.nctu.edu.tw: 140.113.23.3>
[m [1;36m※ 來源:‧中央數學 織夢天堂 BBS.math.ncu.edu.tw‧[FROM: 192.192.186.10] [m