freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

c語(yǔ)言程序設(shè)計(jì)填空題及答案復(fù)習(xí)用(編輯修改稿)

2025-07-23 11:52 本頁(yè)面
 

【文章內(nèi)容簡(jiǎn)介】 Input First String:);scanf(%s,s1);printf(\nPlease Input Second String:);scanf(%s,s2);strsort(s1);strsort(s2);⑩ = 39。\039。;strmerge(s1,s2,s3);printf(\nResult:%s,s3);}【】已知某數(shù)列前兩項(xiàng)為2和3,其后繼項(xiàng)根據(jù)前面最后兩項(xiàng)的乘積,按下列規(guī)則生成:① 若乘積為一位數(shù),則該乘積即為數(shù)列的后繼項(xiàng);② 若乘積為二位數(shù),則該乘積的十位上的數(shù)字和個(gè)位上的數(shù)字依次作為數(shù)列的兩個(gè)后繼項(xiàng)。下面的程序輸出該數(shù)列的前N項(xiàng)及它們的和,其中,函數(shù)sum(n,pa) 返回?cái)?shù)列的前N項(xiàng)和,并將生成的前N項(xiàng)存入首指針為pa的數(shù)組中,程序中規(guī)定輸入的N值必須大于2,且不超過(guò)給定的常數(shù)值MAXNUM?! ?例如:若輸入N的值為10,則程序輸出如下內(nèi)容:sum(10)=442 3 6 1 8 8 6 4 2 4include define MAXNUM 100int sum(n, pa)int n, *pa;{ int count, total, temp;*pa = 2;① =3;total=5;count=2;while( count++n ){ temp = *(pa1) * *pa;if( temp10 ){ total += temp;*(++pa) = temp;}else{ ② = temp/10;total += *pa;if( countn ){ count ++; pa++;③ = temp%10;total += *pa;}}}④ ;}main(){ int n, *p, *q, num[MAXNUM];do{ printf(Input N=? (2N%d):, MAXNUM+1);scanf(%d, amp。n);}while( ⑤ );printf(\nsum(%d)=%d\n, n, sum(n, num));for( p=num, q = ⑥ ; pq; p++ )printf(%4d, *p);printf(\n);}【】下面程序的功能是輸入學(xué)生的姓名和成績(jī),然后輸出。include struct stuinf{ char name[20]; /* 學(xué)生姓名 */int score; /* 學(xué)生成績(jī) */} stu, *p;main ( ){ p=amp。stu;printf(Enter name:);gets( ① );printf(Enter score: );scanf(%d, ② );printf(Output: %s, %d\n, ③ , ④ );}【】下面程序的功能是按學(xué)生的姓名查詢其成績(jī)排名和平均成績(jī)。查詢時(shí)可連續(xù)進(jìn)行,直到輸入0時(shí)才結(jié)束。 include include define NUM 4 struct student { int rank;char *name;float score;}; ① stu[ ]={ 3,liming, 4,zhanghua, 1,anli, 2,wangqi,};main(){ char str[10]; int i; do{ printf(Enter a name); scanf(%s,str); for( i=0;iNUM;i++ ) if( ② ) { printf(Name :%8s\n,stu[i].name); printf(Rank :%3d\n,stu[i].rank); printf(Average :%\n,stu[i].score); ③ ; }  if( i=NUM ) printf(Not found\n); }while( strcmp(str,0)!=0 );}【】下面程序的功能是從終端上輸入5個(gè)人的年齡、性別和姓名,然后輸出。include struct man { char name[20];unsigned age;char sex[7];};main ( ){ struct man person[5];data_in(person,5);data_out(person,5);}data_in(struct man *p, int n ){ struct man *q = ① ;for( ;pq;p++ ) { printf( age:sex:name );scanf(%u%s, amp。page, psex);② ;}}data_out( struct man *p, int n ){ struct man *q = __③__;for( ;pq;p++ )printf(%s;%u;%s\n, pname, page, psex);}【】輸入N個(gè)整數(shù),儲(chǔ)存輸入的數(shù)及對(duì)應(yīng)的序號(hào),并將輸入的數(shù)按從小到大的順序進(jìn)行排列。要求:當(dāng)兩個(gè)整數(shù)相等時(shí),整數(shù)的排列順序由輸入的先后次序決定。例如:輸入的第3個(gè)整數(shù)為5,第7個(gè)整數(shù)也為5,則將先輸入的整數(shù)5排在后輸入的整數(shù)5的前面。程序如下:include define N 10struct{ int no;int num;} array[N];main( ){ int i,j,num;for( i=0;iN;i++ ){ printf(enter No. %d:,i);scanf(%d,amp。num);for( ① ;j=0amp。amp。array[j].num ② num; ③ )array[j+1]=array[j];array[ ④ ].num=num;array[ ⑤ ].no=i;}for( i=0;iN;i++ )printf(%d=%d,%d\n,i,array[i].num,array[i].no);}【】以下程序的功能是:讀入一行字符(如:a、...y、z),按輸入時(shí)的逆序建立一個(gè)鏈接式的結(jié)點(diǎn)序列,即先輸入的位于鏈表尾(如下圖),然后再按輸入的相反順序輸出,并釋放全部結(jié)點(diǎn)。include main( ){ struct node{ char info;struct node *link;} *top,*p;char c;top=NULL;while((c= getchar( )) ① ){ p=(struct node *)malloc(sizeof(struct node));pinfo=c;plink=top;top=p;}while( top ){ ② ;top=toplink;putchar(pinfo);free(p);}}【】下面函數(shù)將指針p2所指向的線性鏈表,串接到p1所指向的鏈表的末端。假定p1所指向的鏈表非空。define NULL 0struct link{ float a;struct link *next;};concatenate ( p1,p2 )struct list *p1,*p2;{ if( p1next==NULL )p1next=p2;elseconcatenate( ① ,p2);}【】下面程序的功能是從鍵盤輸入一個(gè)字符串,然后反序輸出輸入的字符串。include struct node{ char data;struct node *link;}*head;main(){ char ch;struct node *p;head = NULL;while(( ch=getchar())!=39。\n39。 ){ p = (struct node *)malloc(sizeof(struct node));pdata = ch;plink = ① ;head = ② ;}③ ;while( p!=NULL ){ printf(%c , pdata);p = plink;}}【】下面程序的功能是從鍵盤上順序輸入整數(shù),直到輸入的整數(shù)小于0時(shí)才停止輸入。然后反序輸出這些整數(shù)。include struct data { int x;struct data *link;}*p;input(){ int num;struct data *q;printf(Enter data:);scanf(%d, amp。num);if( num0 )① ;q = ② ;qx = num;qlink = p;p=q;③ ;}main(){ printf(Enter data until data0:\n);p=NULL;input();printf(Output:);while( ④ ) { printf(%d\n, px);⑤ ;}}【】下面函數(shù)的功能是創(chuàng)建一個(gè)帶有頭結(jié)點(diǎn)的鏈表,將頭結(jié)點(diǎn)返回給主調(diào)函數(shù)。鏈表用于儲(chǔ)存學(xué)生的學(xué)號(hào)和成績(jī)。新產(chǎn)生的結(jié)點(diǎn)總是位于鏈表的尾部。struct student{ long num;int score;struct student *next;};struct student *creat(){ struct student *head=NULL,*tail;long num; int a;tail= ① malloc(LEN);do{ scanf(%ld,%d,amp。num,amp。a);if(num!=0){ if(head==NULL) head=tail;else ② ;tailnum=num; tailscore=a;tailnext=(struct student *)malloc(LEN);}else tailnext=NULL;}while(num!=0);return( ③ );}【】下面create函數(shù)的功能是建立一個(gè)帶頭結(jié)點(diǎn)的單向鏈表,新產(chǎn)生的結(jié)點(diǎn)總是插入在鏈表的末尾。單向鏈表的頭指針作為函數(shù)值返回。include define LEN sizeof(struct student)struct student{ long num;int score;struct student *next;};struct student *creat()
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)教案相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖片鄂ICP備17016276號(hào)-1