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

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

不換行可以運(yùn)行,換行產(chǎn)生錯(cuò)誤,為什么?

不換行可以運(yùn)行,換行產(chǎn)生錯(cuò)誤,為什么?

C
溯源1 2017-01-22 19:24:54
#include "stdio.h"#include<malloc.h>#include<string.h>#include<ctype.h>#define LEN struct studentstruct student{ char name[22]; int Chinese; int Math; int English; struct student*next;};struct student*create(){ char ch;? ? struct student *head;? ? struct student*p1,*p2;? ? int a=0;? ? printf("是否輸入新數(shù)據(jù):\n");? ?? ? ?while(toupper(ch=getchar())=='Y')? ? {? ? ? p1=(LEN*)malloc(sizeof(LEN));? ? ? printf("name:");? ? ? scanf("%s",&(*p1).name);? ? ? printf("Chinese:");? ? ? scanf("%d",&(*p1).Chinese);? ? ? printf("Math:");? ? ? scanf("%d",&(*p1).Math);? ? ? printf("English:");? ? ? scanf("%d",&(*p1).English);? ? ? getchar();//getchar吸收回車? ? ? printf("是否輸入新數(shù)據(jù):\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("\nname:%-8sChinese:%-5dMath:%-5 dEnglish:%-5d",p->name,p->Chinese,p->Math,p->English);//只是一個(gè)名 p=p->next;//測(cè)試隨便輸 }}void main( ){ //struct student *stu; //stu=create(); print(create());}
查看完整描述

5 回答

已采納
?
Plan_C

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

字符串被截?cái)嗔?,引?hào)不能跨行,可以這樣 寫

printf("123"

"456"

"789");

這樣 "123456789"是一個(gè)字符串

查看完整回答
反對(duì) 回復(fù) 2017-01-24
?
習(xí)慣受傷

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

因?yàn)閾Q行之后,就不是一個(gè)完整的字符串了,破壞了語(yǔ)法,所以會(huì)出錯(cuò)。如果你只想輸出換行,請(qǐng)使用\n轉(zhuǎn)義符。
查看完整回答
1 反對(duì) 回復(fù) 2017-01-22
?
慕后端2529822

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

你可以 拼接起來(lái)

查看完整回答
反對(duì) 回復(fù) 2017-02-09
?
_dark

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

因?yàn)榫庉嬈靼褤Q行認(rèn)為成結(jié)束了,你可以在第一行最后面加個(gè)"\",說(shuō)明這一行和下一行是接著的

查看完整回答
反對(duì) 回復(fù) 2017-01-23
?
BanJim3313278

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

%-5d 是格式輸出,是一個(gè)整體,不能分割

查看完整回答
反對(duì) 回復(fù) 2017-01-23
  • 5 回答
  • 0 關(guān)注
  • 1903 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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