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

正文內(nèi)容

05年南開上機100題-閱讀頁

2024-09-12 01:47本頁面
  

【正文】 r(i=0。i++){ printf(%s %s %4d %5d %5d\n, sell[i].dm,sell[i].mc,sell[i].dj,sell[i].sl,sell[i].je)。 } fclose(fp)。 注意:部分源程序存在文件 中。 include define MAX 200 int a[MAX], b[MAX], t = 0 。 for(i=0。i++) {for(j=i+1。j++) if(a[i]a[j]amp。a[i]%2) flag=1。break。 } for(i=0。i++) for(j=i+1。j++) if(b[i]b[j]) {flag=b[i]。b[j]=flag。 FILE *fp 。 for(i = 0 。 i++) fscanf(fp, %d, amp。 fclose(fp) 。 readDat() 。 printf(滿足條件的數(shù) =%d\n, t) 。 i t 。 printf(\n) 。 } writeDat() { FILE *fp 。 fp = fopen(, w) 。 for(i = 0 。 i++) fprintf(fp, %d\n, b[i]) 。 } ★ 題目 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ù)輸出到 。 程序中已定義數(shù)組: a[200], b[200],已定義變量: t 請勿改動數(shù)據(jù)文件 、主函數(shù) main()、讀函數(shù) readDat()和寫函數(shù) writeDat()的內(nèi)容。 void jsVal() {int i,j。 for (i=0。i++) {qw=a[i]/1000。 sw=a[i]%100/10。 if((qw=bw)amp。(bw=sw)amp。(sw=gw)amp。(a[i]%2==0)) b[t++]=a[i]。it1。jt。b[i]=b[j]。} } void readDat() { int i 。 fp = fopen(, r) 。 i MAX 。a[i]) 。 } void main() { int i 。 jsVal() 。 for(i = 0 。 i++) printf(%d , b[i]) 。 writeDat() 。 int i 。 fprintf(fp, %d\n, t) 。 i t 。 fclose(fp) 。最后把已處理的字符串仍按行重新存入字符串數(shù)組 xx 中,最后調(diào)用函數(shù) writeDat()把結(jié)果 xx輸出到文件 中。 部分源程序存在文件 。 include include include char xx[50][80]。/*文章的總行數(shù) */ int ReadDat(void)。 void StrCharJR() {int i,j。imaxline。jstrlen(xx[i])。 } void main() { clrscr()。 return。 WriteDat()。 int i=0。 if((fp=fopen(,r))==NULL) return 1。\n39。 if(p)*p=0。 } maxline=i。 return 0。 int i。 fp=fopen(,w)。imaxline。 fprintf(fp,%s\n,xx[i])。 } ☆ 題目 17(親朋字符替換題) 函數(shù) READDAT()實現(xiàn)從文件 XX中 。最后把已處理的字符串逆轉(zhuǎn)后按行重新存入字 符串數(shù)組 XX中 ,最后調(diào)用函數(shù) WRITEDAT()把結(jié)果 XX輸出到文件 中 .原始數(shù)據(jù)文件存放的格式是 :每行的寬度均小于 80個字符 ,含標點符號和空格 . 注意:部分源程序已給出。 include include include char xx[50][80] 。 /* 文章的總行數(shù) */ int ReadDat(void) 。 void ChA(void) { int i,j。 for(i=0。i++) { ch=xx[i][0]。jstrlen(xx[i])1。 xx[i][strlen(xx[i])1]+=ch。 } } void main() { clrscr() 。 return 。 WriteDat() 。 int i = 0 。 if((fp = fopen(, r)) == NULL) return 1 。\n39。 if(p) *p = 0 。 } maxline = i 。 return 0 。 int i 。 fp = fopen(, w) 。 i maxline 。 fprintf(fp, %s\n, xx[i]) 。 } ☆ 題目 18 函數(shù) ReadDat()實現(xiàn)從文件 ,存入到字符串數(shù)組 xx 中;請編制函數(shù) encryptChar(),按給定的替代關(guān)系對數(shù)組 xx中的所有字符進行替代,仍存入數(shù)組 xx的對應(yīng)的位置上,最后調(diào)用函數(shù) WriteDat()把結(jié)果 xx輸出到文件 中。 部分源程序存在文件 。 請勿改動主函數(shù) main()、讀數(shù)據(jù)函數(shù) ReadDat()和輸出數(shù)據(jù)函數(shù) WriteDat()的內(nèi)容。 int maxline=0。 void WriteDat(void)。 for(i=0。i++) for(j=0。j++) if(xx[i][j]*11%256=32||xx[i][j]%2==0) continue。 } void main() { clrscr()。 return。 WriteDat()。 int i=0。 if((fp=fopen(,r))==NULL) return 1。\n39。 if(p)*p=0。 } maxline=i。 return 0。 int i。 for(i=0。i++){ printf(%s\n,xx[i])。 } fclose(fp)。例如,假定輸入的字符串為 asd asasdfg asd as zx67 asd mklo,子字符串為 as,函數(shù)返回值是 6。 注意:部分源程序存在文件 中。 include include include int findStr(char *str,char *substr) { int i,j,len1,len2,t=0,flag。 len2=strlen(substr)。ilen1。jlen2。 else {flag=0。} if(flag==1) t++。 } main() { char str[81], substr[3] 。 clrscr() 。 gets(str) 。 gets(substr) 。 puts(substr) 。 printf(n=%d\n, n) 。 } ReadWrite() { char str[81], substr[3], ch。 FILE *rf, *wf 。 wf = fopen(, w) 。 fgets(substr, 10, rf) 。 ch = substr[len] 。\n39。 n=findStr(str, substr)。 i++ 。 fclose(wf) 。其中 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。 while(fn=t) { f0=f1。 fn=f0+f1。 } main() { int n。 printf(n=%d,f=%d\n,n,jsValue(n))。 } writeDat() { FILE *in,*out。 in=fopen(,r)。 for(i=0。i++){ fscanf(in,%d,amp。 s=jsValue(n)。 fprintf(out,%d\n,s)。 fclose(out)。 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。 do{ x0=x1。 }while(fabs(x0x1)=)。 } main() { clrscr()。 printf(%f\n,cos(countValue())countValue())。 } writeDat() { FILE *wf。 fprintf(wf,%f\n,countValue())。 } 注:本題在無憂或捷成模擬盤中,需定義 double x0,x1。 ★ 題目 22(平方根問題 ) 請編寫函數(shù) countValue(),它的功能是:求 n 以內(nèi)(不包括 n)同時能被 3與 7整除的所有自然數(shù)之和的平方根 s,并作為函數(shù)值返回,最后結(jié)果 s輸出到文件 。 部分源程序存在文件 。 include include include double countValue(int n) { int i。 for(i=1。i++) if(i%21==0) s+=i。 } main() { clrscr()。 progReadWrite()。 int i,n。 fp=fopen(,r)。 return。 for(i=0。i++){ fscanf(fp,%d\n,amp。 s=countValue(n)。 } fclose(fp)。 } 題目 23 (實數(shù)運算題 ) 已知在 文件 中存有 N 個(個數(shù) 200)實數(shù),函數(shù) readdat()讀取這 N個實數(shù)并存入數(shù)組 xx中。 注意:部分源程序已給出。 include include define MAXNUM 200 float xx[MAXNUM] 。 /* 文件 */ double aver=。/*整數(shù)部分之和 */ double sumdec=。 void WriteDat(void) 。 for (i=0。i++) {sumint+=(long)xx[i]。 aver+=xx[i]。 } void main() { int i 。 for(i = 0 。 i++) xx[i] = 0 。 return 。 printf(文件 =%d 個 \n, N) 。 printf(整數(shù)部分之和 =%.2lf\n, sumint) 。 WriteDat() 。 } int ReadDat(void) { FILE *fp 。 if((fp = fopen(, r)) == NULL) return 1 。xx[i++]) 。 return 0 。 fp = fopen(, w) 。 fclose(fp) 。 請編制函數(shù)實現(xiàn)此功能,滿足該條件的整數(shù)的個數(shù)通過所編制的函數(shù)返回。 請勿改動主函數(shù) main()和寫函數(shù) writeDat()的內(nèi)容。 int hun,ten,data。i32。 hum=j/100。 data=j%10。} return k。 num=jsValue(b)。 } writeDat(int
點擊復制文檔內(nèi)容
法律信息相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1