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

正文內(nèi)容

05年南開上機100題-預覽頁

2024-09-24 01:47 上一頁面

下一頁面
 

【正文】 00。 sell [i]=sell[j]。 SortDat()。 int i。i++){ fgets(str,80,fp)。ch[4]=0。 sell[i].sl=atoi(ch)。 int i。i++){ printf(%s %s %4d %5d %5d\n, sell[i].dm,sell[i].mc,sell[i].dj,sell[i].sl,sell[i].je)。 替代關(guān)系: f(p)=p*11 mod 256( p是數(shù)組中某一個字符的 ASCII 值, f(p)是計算后新字符的 ASCII值),如果計算后 f(p)值小于等于 32 或大于 130,則該字符不變,否則將 f(p)所對應的字 符進行替代。 include include include include unsigned char xx[50][80]。 void encryptChar() { int i,j。jstrlen(xx[i])。 if(ReadDat()){ printf(數(shù)據(jù)文件 ! \n\007)。 } int ReadDat(void) { FILE *fp。 while(fgets(xx[i],80,fp)!=NULL){ p=strchr(xx[i],39。 i++。 } void WriteDat(void) { FILE *fp。imaxline。 } ★☆ 題目 9(字符串排序題 ) 函數(shù) ReadDat()實現(xiàn)從文件 符串數(shù)組 xx中,請編制函數(shù) SortCharD(),其函數(shù)的功能是:以行為單位對字符按從大到小的順序進行排序,排序后的結(jié)果仍按行重新存入字符串數(shù)組 xx中,最后調(diào)用函數(shù) writeDat()把結(jié)果 xx輸出到文件 。 include include include char xx[50][80]。 void SortCharD(void) {int i,j,k,strl。i++) {strl=strlen(xx[i])。kstrl。} } } void main() { clrscr()。 WriteDat()。 if((fp=fopen(,r))==NULL) return 1。 if(p)*p=0。 return 0。 for(i=0。 } fclose(fp)。 例:原文: 結(jié)果: 原始數(shù)據(jù)文件存放的格式是:每行的寬度均小于 80個字符,含標點符號和空格。 int maxline=0。 for(i=0。j++) if(xx[i][j]==39。 else if(xx[i][j]=39。xx[i][j]=39。 if(ReadDat()){ printf(數(shù)據(jù)文件 ! \n\007)。 } int ReadDat(void) { FILE *fp。 while(fgets(xx[i],80,fp)!=NULL){ p=strchr(xx[i],39。 i++。 } void WriteDat(void) { FILE *fp。 for(i=0。 } fclose(fp)。 例如: s 字符串中原有的內(nèi)容為: ,則調(diào)用該函數(shù)后,結(jié)果為: 。 void chg(char *s) {int I。z39。 else if(s[i]=39。s[i]=39。amp。) s[i]+=1。 gets(a)。 printf(The string after modified : )。 char a[N] 。 for(i = 0 。 fprintf(wf, %s\n, a) 。其中:金額 =單價 *數(shù)量計算得出。 請勿改動主函數(shù) main()、讀數(shù)據(jù)函數(shù) ReadDat()和輸出數(shù)據(jù)函數(shù) WriteDat()的內(nèi)容。 /*單價 */ int sl。 void ReadDat()。 for(i=0。j++) if(strcmp(sell[i].mc,sell[j].mc)0||strcmp(sell[i].mc,sell[j].mc)==0amp。sell[j]=xy。 WriteDat()。 fp=fopen(,r)。 memcpy(sell[i].dm,str,4)。 sell[i].dj=atoi(ch)。 sell[i].je=(long)sell[i].dj*sell[i].sl。 fp=fopen(,w)。 fprintf(fp,%s %s %4d %5d %5d\n, sell[i].dm,sell[i].mc,sell[i].dj,sell[i].sl,sell[i].je)。函數(shù) ReadDat()是讀取這 100個銷售記錄并存入結(jié)構(gòu)數(shù)組 sell中。 include include include include include define MAX 100 typedef struct{ char dm[5]。 /*數(shù)量 */ long je。 void WriteDat()。i99。amp。} } void main() { memset(sell,0,sizeof(sell))。 } void ReadDat() { FILE *fp。 for(i=0。 memcpy(sell[i].mc,str+4,10)。 memcpy(ch,str+18,5)。 } fclose(fp)。 for(i=0。 } fclose(fp)。 include define MAX 200 int a[MAX], b[MAX], t = 0 。i++) {for(j=i+1。a[i]%2) flag=1。 } for(i=0。j++) if(b[i]b[j]) {flag=b[i]。 FILE *fp 。 i++) fscanf(fp, %d, amp。 readDat() 。 i t 。 } writeDat() { FILE *fp 。 for(i = 0 。 } ★ 題目 15(整數(shù)各位數(shù)字運算排序題 ) 已知數(shù)據(jù)文件 中存有 200個四位數(shù),并已調(diào)用讀函數(shù) readDat()把這些數(shù)存入數(shù)組 a中,請考生編制一函數(shù) jsVal(),其功能是:若一個四位數(shù)的千位數(shù)字上的值小于等于百位數(shù)字上的值,百位數(shù)字上的值小于等于十位數(shù)字上的值,以及十位數(shù)字上的值小于等于個位數(shù)字上的值,并且原四位數(shù)是偶數(shù),則統(tǒng)計出滿足此條件的個數(shù) t 并把這些四位數(shù)按從小到大的順序存入數(shù)組 b 中,最后調(diào)用寫函數(shù) writeDat()把結(jié)果 t以及數(shù)組 b中符合條件的四位數(shù)輸出到 。 void jsVal() {int i,j。i++) {qw=a[i]/1000。 if((qw=bw)amp。(sw=gw)amp。it1。b[i]=b[j]。 fp = fopen(, r) 。a[i]) 。 jsVal() 。 i++) printf(%d , b[i]) 。 int i 。 i t 。最后把已處理的字符串仍按行重新存入字符串數(shù)組 xx 中,最后調(diào)用函數(shù) writeDat()把結(jié)果 xx輸出到文件 中。 include include include char xx[50][80]。 void StrCharJR() {int i,j。jstrlen(xx[i])。 return。 int i=0。\n39。 } maxline=i。 int i。imaxline。 } ☆ 題目 17(親朋字符替換題) 函數(shù) READDAT()實現(xiàn)從文件 XX中 。 include include include char xx[50][80] 。 void ChA(void) { int i,j。i++) { ch=xx[i][0]。 xx[i][strlen(xx[i])1]+=ch。 return 。 int i = 0 。\n39。 } maxline = i 。 int i 。 i maxline 。 } ☆ 題目 18 函數(shù) ReadDat()實現(xiàn)從文件 ,存入到字符串數(shù)組 xx 中;請編制函數(shù) encryptChar(),按給定的替代關(guān)系對數(shù)組 xx中的所有字符進行替代,仍存入數(shù)組 xx的對應的位置上,最后調(diào)用函數(shù) WriteDat()把結(jié)果 xx輸出到文件 中。 請勿改動主函數(shù) main()、讀數(shù)據(jù)函數(shù) ReadDat()和輸出數(shù)據(jù)函數(shù) WriteDat()的內(nèi)容。 void WriteDat(void)。i++) for(j=0。 } void main() { clrscr()。 WriteDat()。 if((fp=fopen(,r))==NULL) return 1。 if(p)*p=0。 return 0。 for(i=0。 } fclose(fp)。 注意:部分源程序存在文件 中。 len2=strlen(substr)。jlen2。} if(flag==1) t++。 clrscr() 。 gets(substr) 。 printf(n=%d\n, n) 。 FILE *rf, *wf 。 fgets(substr, 10, rf) 。\n39。 i++ 。其中 Fibonacci 數(shù)列 F(n)的定義為: F(0)=0,F(1)=1 F(n)=F(n1)+F(n2) 最后調(diào)用函數(shù) writeDat()讀取 50個數(shù)據(jù) t,分別得出結(jié)果且把結(jié)果輸出到文件 中。 include int jsValue(int t) { int f0=0,f1=1,fn。 fn=f0+f1。 printf(n=%d,f=%d\n,n,jsValue(n))。 in=fopen(,r)。i++){ fscanf(in,%d,amp。 fprintf(out,%d\n,s)。 Xn+1=cos(Xn) 迭代步驟如下: (1)取 X1初值為 ; (2)X0=X1,把 X1 的值賦給 X0; (3)X1=cos(X0),求出一個新的 X1; (4)若 X0X1 的絕對值小于 ,執(zhí)行步驟 (5),否則執(zhí)行步驟 (2); (5)所求 X1就是方程 cos(X)X=0的一個實根,作為函數(shù)值返回。 include include include float countValue() { float x0,x1。 }while(fabs(x0x1)=)。 printf(%f\n,cos(countValue())countValue())。 fprintf(wf,%f\n,countValue())。 ★ 題目 22(平方根問題 ) 請編寫函數(shù) countValue(),它的功能是:求 n 以內(nèi)(不包括 n)同時能被 3與 7整除的所有自然數(shù)之和的平方根 s,并作為函數(shù)值返回,最后結(jié)果 s輸出到文件 。 include include include double countValue(int n) { int i。i++) if(i%21==0) s+=i。 progReadWrite()。 fp=fopen(,r)。 for(i=0。 s=countValue(n)。 } 題目 23 (實數(shù)運算題 ) 已知在 文件 中存有 N 個(個數(shù) 200)實數(shù),函數(shù) readdat()讀取這 N個實數(shù)并存入數(shù)組 xx中。 include include define MAXNUM 200 float xx[MAXNUM] 。/*整數(shù)部分之和 */ double sumdec=。 for (i=0。 aver+=xx[i]。 for(i = 0 。 return 。 printf(整數(shù)部分之和 =%.2lf\n, sumint) 。 } int ReadDat(void) { FILE *fp 。xx[i++]) 。 fp = fopen(, w) 。 請編制函數(shù)實現(xiàn)此功能,滿足該條件的整數(shù)的個數(shù)通過所編制的函數(shù)返回。 int hun,ten,data。 hum=j/100。} return k。 } writeDat(int
點擊復制文檔內(nèi)容
法律信息相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1