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

正文內(nèi)容

三級網(wǎng)絡(luò)就似乎上機(jī)南開100題-資料下載頁

2025-01-10 03:23本頁面
  

【正文】 f(p)所 對應(yīng)的字符進(jìn)行替代。 部分源程序存在文件 。原始數(shù)據(jù)文件存放的格式是:每行的寬度均小于80個字符。 請勿改動主函數(shù) main()、讀數(shù)據(jù)函數(shù) ReadDat()和輸出數(shù)據(jù)函數(shù) WriteDat()的內(nèi)容。 include include include include unsigned char xx[50][80]。 int maxline=0。/*文章的總行數(shù) */ int ReadDat(void)。 void WriteDat(void)。 void encryptChar() { int i,j。 for(i=0。imaxline。i++) for(j=0。jstrlen(xx[i])。j++) if(xx[i][j]*11%256=32||xx[i][j]%2==0) continue。 else xx[i][j]=xx[i][j]*11%256。 } void main() { clrscr()。 if(ReadDat()){ printf(數(shù)據(jù)文件 !\n\007)。 return。 } encryptChar()。 WriteDat()。 } int ReadDat(void) { FILE *fp。 int i=0。 unsigned char *p。 if((fp=fopen(,r))==NULL) return 1。 while(fgets(xx[i],80,fp)!=NULL){ p=strchr(xx[i],39。\n39。)。 if(p)*p=0。 i++。 } maxline=i。 fclose(fp)。 return 0。 } void WriteDat(void) { FILE *fp。 int i。 fp=fopen(,w)。 for(i=0。imaxline。i++){ printf(%s\n,xx[i])。 fprintf(fp,%s\n,xx[i])。 } fclose(fp)。 } ****************************************************************************** ☆題目 19(單詞個數(shù)統(tǒng)計題 ) 編寫一個函數(shù) findStr(char *str,char *substr),該函數(shù) 統(tǒng)計一個長度為 2的子字符串在另一個字符串中出現(xiàn)的次數(shù) 。例如, 假定輸入的字符串為 asd asasdfg asd as zx67 asd mklo,子字符串為 as,函數(shù)返回值是 6。 函數(shù) ReadWrite()實現(xiàn)從文件,并調(diào)用函數(shù)findStr(),最后把結(jié)果輸出到文件 。 注意:部分源程序存在文件 中。 請勿改動主 函數(shù) main()和其它函數(shù)中的任何內(nèi)容,僅在函數(shù) findStr()的花括號中填入你編寫的若干語句。 include include include int findStr(char *str,char *substr) { int i,j,len1,len2,t=0,flag。 len1=strlen(str)。 len2=strlen(substr)。 for(i=0。ilen1。i++) { for(j=0。jlen2。j++) if(str[i+j]==substr[j]) flag=1。 else {flag=0。break。} if(flag==1) t++。 } return t。 } main() { char str[81], substr[3] 。 int n 。 clrscr() 。 printf(輸入原字符串 :) 。 gets(str) 。 printf(輸入子字符串 :) 。 gets(substr) 。 puts(str) 。 puts(substr) 。 n=findStr(str, substr) 。 printf(n=%d\n, n) 。 ReadWrite() 。 } ReadWrite() { char str[81], substr[3], ch。 int n, len, i = 0。 FILE *rf, *wf 。 rf = fopen(, r) 。 wf = fopen(, w) 。 while(i 25) { fgets(str, 80, rf) 。 fgets(substr, 10, rf) 。 len = strlen(substr) 1 。 ch = substr[len] 。 if(ch == 39。\n39。 || ch == 0x1a) substr[len] = 0 。 n=findStr(str, substr)。 fprintf(wf, %d\n, n) 。 i++ 。 } fclose(rf) 。 fclose(wf) 。 } **************************************************************************** ★題目 20( Fibonacci數(shù)列題 ) 編寫函數(shù) jsValue,它的功能是: 求 Fibonacci數(shù)列中大于 t的最小的一個數(shù),結(jié)果由函數(shù)返回。其中 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é)果輸出到文件。 例如:當(dāng) t=1000 時,函數(shù)值為: 1597。 部分源程序存在文件 。 請勿改動主函數(shù) main()和寫函數(shù)writeDat()的內(nèi)容。 include int jsValue(int t) { int f0=0,f1=1,fn。 fn=f0+f1。 while(fn=t) { f0=f1。 f1=fn。 fn=f0+f1。 } return fn。 } main() { int n。 n=1000。 printf(n=%d,f=%d\n,n,jsValue(n))。 writeDat()。 } writeDat() { FILE *in,*out。 int i,n,s。 in=fopen(,r)。 out=fopen(,w)。 for(i=0。i50。i++){ fscanf(in,%d,amp。n)。 s=jsValue(n)。 printf(%d\n,s)。 fprintf(out,%d\n,s)。 } fclose(in)。 fclose(out)。 } ☆題目 21(迭代方法 求方程題 ) 下列程序 : 利用以下所示的簡單迭代方法求方程: cos(x)x=0的一個實根。 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ù)值返回。 請編寫函數(shù) countValue()實現(xiàn)程序的要求,最后調(diào)用 函數(shù) writeDat()把結(jié)果輸出到文件 。 部分源程序已給出。 請勿改動主函數(shù) main()和輸出數(shù)據(jù)函數(shù) writeDat()的內(nèi)容。 include include include float countValue() { float x0,x1。 x1=。 do{ x0=x1。 x1=cos(x0)。 }while(fabs(x0x1)=)。 return x1。 } main() { clrscr()。 printf(實根 =%f\n,countValue())。 printf(%f\n,cos(countValue())countValue())。 writeDat()。 } writeDat() { FILE *wf。 wf=fopen(,w)。 fprintf(wf,%f\n,countValue())。 fclose(wf)。 } 注:本題在無憂或捷成模擬盤中,需定義double x0,x1。才能通過,據(jù)實際上機(jī) 抽到該題的考生反映,實際上機(jī)需按上面解法的定義方能通過,特此說明,供參考。 **************************************************************************** ★題目 22(平方根問題 ) 請編寫函數(shù) countValue(),它的功能是: 求n以內(nèi)(不包括 n)同時能被 3與 7整除的所有自然數(shù)之和的平方根 s,并作為函數(shù)值返回, 最后結(jié)果 s輸出到文件 。 例如若 n為 1000 時,函數(shù)值應(yīng)為:s=。 部分源程序 存在文件 。 請勿改動主函數(shù) main()和輸入輸出數(shù)據(jù)函數(shù) progReadWrite()的內(nèi)容。 include include include double countValue(int n) { int i。 double s=。 for(i=1。in。i++) if(i%21==0) s+=i。 return sqrt(s)。 } main() { clrscr()。 printf(自然數(shù)之和的平 方根=%f\n,countValue(1000))。 progReadWrite()。 } progReadWrite() { FILE *fp,*wf。 int i,n。 float s。 fp=fopen(,r)。 if(fp==NULL){ printf(數(shù)據(jù)文件 在 !)。 return。 } wf=fopen(,w)。 for(i=0。i10。i++){ fscanf(fp,%d\n,amp。n)。 s=countValue(n)。 fprintf(wf,%f\n,s)。 } fclose(fp)。 fclose(wf)。 } ********************************************************************* 題目 23 (實數(shù)運(yùn)算題 ) 已知在文件 N個(個數(shù) 200)實數(shù),函數(shù) readdat()讀取這 N個實數(shù)并存入數(shù)組xx中。請編制函數(shù) calvalue(),其功能要求: 求出這 N個實數(shù)的平均值 aver; 分別 求出這 N個實數(shù)的整數(shù)部分之和sumint以及小數(shù)部分之和 sumdec, 最后調(diào)用函數(shù)writedat()把所求的結(jié)果輸出到文件 。 注意:部分源程序已給出。 請勿改動主函數(shù) main()、讀數(shù)據(jù)函數(shù) readdat()和輸出數(shù)據(jù)函數(shù) writedat()的內(nèi)容。 include include define MAXNUM 200 float xx[MAXNUM] 。 int N= 0 。 /* 文件 中共有多少個實數(shù) */ double aver=。/*平均值 */ double sumint=。/*整數(shù)部分之和 */ double sumdec=。/*小數(shù)部分之和 */ int ReadDat(void) 。 void WriteDat(void) 。 void CalValue(void) {int i。 for (i=0。iN。i++) {sumint+=(long)xx[i]。 sumdec+=xx[i](long)xx[i]。 aver+=xx[i]。 } aver/=N。 } void main() { int i 。 clrscr() 。 for(i = 0 。 i MAXNUM 。 i++) xx[i] = 0 。 if(ReadDat()) { printf(數(shù)據(jù)文件 開 !\007\n) 。 return 。 } Calvalue() 。 printf(文件 =%d個 \n, N) 。 printf(平均值 =%.2lf\n, aver) 。 printf(整數(shù)部分之和 =%.2lf\n, sumi
點(diǎn)擊復(fù)制文檔內(nèi)容
試題試卷相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1