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

正文內(nèi)容

程序設(shè)計習(xí)題解答-資料下載頁

2025-03-25 06:41本頁面
  

【正文】 i++) { for(j=0。jn。j++) { coutp[i][j]39。\t39。 } coutendl。 }}void main(){ int m,n。 int i,j。 int **p。 coutPlease Enter Quanlity of Student amp。 Course endl。 cinmn。 p=new int* [m]。 for(i=0。im。i++) { p[i]=new int[n]。 } input(p,m,n)。 print(p,m,n)。}/*P196T713編制函數(shù)*ReplaceString(char* str,char* s1,char *s2);該函數(shù)用s2替換str中的s1,函數(shù)返回替換后的串的指針,如果str中沒有s1則返回0。*/include iostreaminclude using namespace std。char *ReplaceString(char* str,char* s1,char *s2){ char *tmp=strstr(str,s1)。 if(tmp==NULL) return 0。 int len=strlen(str)。 int len1=strlen(s1)。 int len2=strlen(s2)。 if(len1=len2) { while(*tmp++=*s2++)。 tmp。 while(*tmp=*(tmp+len1len2)) tmp++。 } else { for(int i=0。ilen1。i++) *tmp++=*s2++。 int L=strlen(tmp)+1。 for(int i=0。i=L。i++) *(tmp+L+len2len1i)=*(tmp+Li)。 while(*s2) *tmp++=*s2++。 } return str。}void main(){ char str[81]=this is a demo string。 char *s1=ing。 char *s2=string。 coutReplaceString(str,s1,s2)。}Chapter 8/*p222T803編寫一個函數(shù)day,該函數(shù)以date結(jié)構(gòu)作為參數(shù),day返回某日是該年的第幾天*/include iostreamusing namespace std。static int monthday[][13]={{0,31,28,31,30,31,30,31,31,30,31,30,31}, {0,31,29,31,30,31,30,31,31,30,31,30,31}}。struct DATE{ int year,month,day。}。int isleapyear(const DATE amp。date){ return %4==0 amp。amp。 %100 || %400。}int day(const DATE amp。date){ int sum=0。 int i。 int isleap=isleapyear(date)。 for(i=1。i。i++) { sum+=monthday[isleap][i]。 } sum+=。 return sum。}void main(){ DATE date={2006,1,1}。 coutday(date)endl。}/*p222 T080304說明一個日期結(jié)構(gòu)date、成員包括年、月、日。考慮應(yīng)該為該結(jié)構(gòu)定義哪些函數(shù)。編寫一個函數(shù)day,該函數(shù)使用date作為參數(shù),函數(shù)返回某日是這年的第幾天。*/include iostreamusing namespace std。typedef struct _DATE{ int year,month,day。}DATE。static monthday[][31]={ {0,31,28,31,30,31,30,31,31,30,31,30,31}, {0,31,29,31,30,31,30,31,31,30,31,30,31}}。int datecmp(DATE amp。date1,DATE amp。date2)。int daynum(DATE amp。date)。int isleapyear(const DATE amp。date)。int isleapyear(int year)。//返回兩個日期之間的天數(shù)int datediff(DATE amp。date1,DATE amp。date2){ int sum=0,i。 DATE d1=date1,d2=date2,d3。 if(datecmp(d1,d2)==1) { d3=d1。 d1=d2。 d2=d3。 } else if(datecmp(d1,d2)==0) return 0。 if(isleapyear(d1)) sum+=366daynum(d1)。 else sum+=365daynum(d1)。 sum+=daynum(d2)。 for(i=+1。i。i++) if(isleapyear(i)) sum+=366。 else sum+=365。 return sum。}int datecmp(DATE amp。date1,DATE amp。date2){ if() return 1。 else if () return 1。 else if() return 1。 else if() return 1。 else if() return 1。 else if() return 1。 else return 0。}/**/DATE dateadd(DATE amp。date1,int n){ DATE d=date1。 int leapyear=isleapyear(d)。 while(n+monthday[isleapyear(d)][]) { ++。 if(12) { ++。 =1。 } n = monthday[isleapyear(d)][]。 n。 =1。 } +=n。 return d。}int isleapyear(const DATE amp。date){ return %4==0 amp。amp。 %100!=0 || %400==0。}int isleapyear(int year){ return year%4==0 amp。amp。 year%100!=0 || year%400==0。}int validdate(DATE amp。date){ if(!(=0 amp。amp。 =9999)) return 0。 if(1|| 12) return 0。 if(1) return 0。 if(=monthday[isleapyear(date)][]) return 1。 return 0。}int year(DATE amp。date){ return 。}int month(DATE amp。date){ return 。}int day(DATE amp。date){ return 。}int daynum(DATE amp。date){ int sum=0。 int i。 int isleap=isleapyear(date)。 for(i=1。i。i++) sum+=monthday[isleap][i]。 sum+=。 return sum。}void print(DATE amp。date){ coutendl。}void main(){ DATE day1={2007,12,29}。 DATE day2={2012,12,31}。 print(dateadd(day1,365+3))。}/*p222T85建立一個聯(lián)合體union integer*/include iostreamusing namespace std。union integer{ char c。 short s。 int i。 long l。}。void main(){ char c。 short s。 int i。 long l。 integer b。 cincsil。 =c。 coutchar:\t short:\t int:\t long:endl。 =s。 coutchar:\t short:\t int:\t long:endl。 =i。 coutchar:\t short:\t int:\t long:endl。 =l。 coutchar:\t short:\t int:\t long:endl。}/*p222 T80609使用結(jié)構(gòu)體變量來表示學(xué)生數(shù)據(jù):姓名、學(xué)號和門課程的成績。從鍵盤輸入個學(xué)生的數(shù)據(jù),要求打印出每個學(xué)生的姓名和三門課程的平均成績此外:要求按學(xué)生的平均成績降序輸出按學(xué)生姓名搜索*/include fstreaminclude iostreamusing namespace std。struct student{ int num。 char name[20]。 float score[3]。}。//從文件中讀取數(shù)據(jù)void input(student* std,int n){ ifstream fin(,ios::in)。 for(int i=0。in。i++) { finstd[i].name。 finstd[i].num。 finstd[i].score[0]std[i].score[1]std[i].score[2]。 } return 。}//輸出學(xué)生信息void print(student* std,int n){ int i。 for(i=0。in。i++) { coutstd[i].name\t std[i].num39。\t39。 std[i].score[0]39。\t39。 std[i].score[1]39。\t39。 std[i].score[2]39。\t39。 (std[i].score[0]+std[i].score[1]+std[i].score[2])/339。\t39。endl。 }}//按成績排序void sort(student* std,int n){ int i,j,L。 student tmp。 for(i=0。in1。i++) { L=i。 for(j=i+1。jn。j++) { if(std[j].score[0]+std[j].score[1]+std[j].score[2] std[L].score[0]+std[L].score[1]+std[L].score[2]) L=j。 } tmp=std[i]。 std[i]=std[L]。 std[L]=tmp。 }}//按姓名搜索int search(student* std,int n,char* name){ int i。 for(i=0。in。i++) { if(strcmp(std[i].name,name)==0) return i。 } return 1。}void main(){ student std[10]。 input(std,10)。 print(std,10)。 sort(std,10)。 int i=search(std,10,wangwu1)。 if(i!=1) coutFoundendl。 else coutNo Foundendl。}//,程序中用到文件中的數(shù)據(jù)zsan 101 34 56 78lisi 102 34 56 78wangwu 103 34 56 78John 104 65 32
點擊復(fù)制文檔內(nèi)容
畢業(yè)設(shè)計相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1