第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會有你想問的

動態(tài)鏈表,怎么才能改成像課本上的可以輸入輸出多次,

動態(tài)鏈表,怎么才能改成像課本上的可以輸入輸出多次,

#include "stdio.h"#include<malloc.h>#include<string.h>#define LEN sizeof(struct student)struct student{int num;int score;struct student*next;};struct student*create(){? ? char ch;? ? struct student *head;? ? struct student*p1,*p2;? ? int a=0;? ? printf("是否輸入新數(shù)據(jù):(y/n)");? ? while(toupper(ch=getche())=='Y');//這個(gè)不是要輸入輸出y多次,輸入輸出多個(gè)num,score,直到ch不等于y,但是為什么只有輸入輸出一次? ? {? ? p1=(struct student*)malloc(LEN);? ? printf("\n請輸入:");? ? scanf("%d%d",&p1->num,&p1->score);? ? printf("是否輸入新數(shù)據(jù):(y/n)");? ? a++;? ? if(a==1) head=p1;? ? else p2->next=p1;? ? p2=p1;? ? p1->next=NULL;? ? }? ? return(head);}void print(struct student *head){struct student *p;p=head;while(p!=NULL){printf("\n學(xué)號:%d,成績:%d",p->num,p->score);p=p->next;}}void main( ){struct student *stu;stu=create();print(stu);}
查看完整描述

1 回答

已采納
?
望遠(yuǎn)

TA貢獻(xiàn)1017條經(jīng)驗(yàn) 獲得超1032個(gè)贊

while(toupper(ch=getche())=='Y');//這個(gè)不是要輸入輸出y多次,輸入輸出多個(gè)num,score,
//結(jié)尾處多了個(gè);循環(huán)是空循環(huán)體。


查看完整回答
1 反對 回復(fù) 2017-01-16
點(diǎn)擊展開后面7
  • 1 回答
  • 0 關(guān)注
  • 1503 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號