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

正文內容

05年南開上機100題-wenkub

2022-09-03 01:47:20 本頁面
 

【正文】 移到已處理字符串的左邊存放,之后把已處理的字符串仍按行重新存入字符串數(shù)組 xx中。 for(i = 0 。 } writeDat() { FILE *fp 。 i t 。 readDat() 。 i++) fscanf(fp, %d, amp。 FILE *fp 。j++) if(b[i]b[j]) { qw=b[i]。 } for(i=0。amp。amp。 bw=a[i]/100%10。 void jsVal() { int i,j,qw,bw,sw,gw。最后 main( )函數(shù)調用寫函數(shù) writeDat()把結果 t 以及數(shù)組 b中符合條件的四位數(shù)輸出到 中。 fprintf(wf,\n)。 num(m,n,xx)。i10。 FILE *rf,*wf。m++) printf(%d ,xx[m])。n)。 clrscr()。k0。i++) if(m % i==0)return 0。 include include void readwriteDat()。 最后調用函數(shù) writeDat()讀取 10組數(shù)據(jù),分別得出結果且把結果輸出到文件 。 每種題目,只用一種解題方法, 加粗 部分為解題答案,此種方法本人覺得容易理解,不易出錯,適合初學者。 特別說明:所有解法,本人均上機驗證通過。 部分源程序存在文件 。 int isP(int m) { int i。 return 1。m++) if(isP(m)) { xx[s++]=m。 printf(\nPlease enter two integers:)。 num(m,n,xx)。 printf(\n)。 rf=fopen(,r)。i++){ fscanf(rf,%d %d,amp。 for(m=0。 } fclose(rf)。 注意:部分源程序存在文件 中。 for(i=0。 sw=a[i]%100/10。qw%2==0amp。sw%2==0amp。it1。 b[i]=b[j]。 fp = fopen(, r) 。a[i]) 。 jsVal() 。 i++) printf(%d , b[i]) 。 int i 。 i t 。最后 main()函數(shù)調用函數(shù) WriteDat()把結果 xx輸出到文件 。 include include include char xx[50][80] 。 void StrOR(void) {int i,righto,j,s,k。i++) for(j=strlen(xx[i])1。 if(xx[i][j]==39。sstrlen(xx[i])。s++) if(xx[i][s]!=39。 } else continue。 } StrOR() 。 char *p 。) 。 fclose(fp) 。 clrscr() 。 i++) { printf(%s\n, xx[i]) 。最后把已處理的字符串(應不含標點符號)仍按行重新存入字符串數(shù)組 xx中,最后調用函數(shù) writeDat()把結果 xx輸出到文件 中。 include include include include char xx[50][80]。 void StrOL(void) { int i,j,k,s,m,strl。i++) { strl=strlen(xx[i])。j=0。m++) str[s++]=xx[i][j+m]。 } for(m=1。\039。 return。 int i=0。\n39。 } maxline=i。 int i。imaxline。 } ******************************************************************************* ☆ 題目 5(整數(shù)排序題 ) 在文件 中有 200 個正整數(shù),且每個數(shù)均在 1000 至 9999 之間。 例:處理前 6012 5099 9012 7025 8088 處理后 9012 6012 7025 8088 5099 部分源程序存在文件 。 for(i=0。j++) if(aa[i]%1000aa[j]%1000||aa[i]%1000==aa[j]%1000amp。aa[j]=data。 } void main() { readDat()。 int i。 i++) fscanf(in,%d,amp。 int i。 i10。 } ☆ 題目 6 正整數(shù)排序 在文件 中有 200 個正整數(shù),且每個數(shù)均在 1000 至 9999 之間。 例:處理前 9012 5099 6012 7025 8088 處理后 5099 8088 7025 6012 9012 注意:部分源程序已給出。 for(i=0。j++) if(aa[i]%1000aa[j]%1000||aa[i]%1000==aa[j]%1000amp。aa[j]=data。 } void main() { readDat()。 } readDat() { FILE *in。 i200。 } writeDat() { FILE *out。 for(i=0。 } fclose(out)。請編制函數(shù) SortDat(),其功能要求:按產(chǎn)品代碼從大到小進行排列,若產(chǎn)品代碼相同,則按金額從大到小進行排列,最終排列結果仍存入結構數(shù)組 sell中,最后調用函數(shù) WriteDat()把結果 輸出到文件 中。 /*產(chǎn)品代碼 */ char mc[11]。 /*金額 */ }PRO。 void SortDat() {int i,j。i++) for(j=i+1。sell[i].jesell[j].je) {xy=sell[i]。 ReadDat()。 char str[80],ch[11]。i100。 memcpy(ch,str+14,4)。ch[5]=0。 } void WriteDat(void) { FILE *fp。i100。 } ★ 題目 8(字符替換題 ) 函數(shù) ReadDat()實現(xiàn)從文件 ,存入到字符串數(shù)組 xx 中;請編制函數(shù) encryptChar(), 按給定的替代關系對數(shù)組 xx中的所有字符進行替代,仍存入數(shù)組 xx的對應的位置上,最后調用函數(shù) WriteDat()把結果 xx輸出到文件 中。 請勿改動主函數(shù) main()、讀數(shù)據(jù)函數(shù) ReadDat()和輸出數(shù)據(jù)函數(shù) WriteDat()的內容。 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)。 請勿改動主函數(shù) main()、讀數(shù)據(jù)函數(shù) ReadDat()和輸出數(shù)據(jù)函數(shù) writeDat()的內容。 void WriteDat(void)。imaxline。j++) for(k=j+1。 xx[i][k]=ch。 } SortCharD()。 char *p。)。 fclose(fp)。 fp=fopen(,w)。 fprintf(fp,%s\n,xx[i])。把已處理的字符串仍按行重新存入字符串數(shù)組 xx 中,最后調用函數(shù) writeDat()把結果 xx輸出到文件 。 include include include char xx[50][80]。 void ConvertCharA(void) { int i,j。jstrlen(xx[i])。a39。amp。 } } void main() { clrscr()。 WriteDat()。 if((fp=fopen(,r))==NULL) return 1。 if(p)*p=0。 return 0。 fp=fopen(,w)。 fprintf(fp,%s\n,xx[i])。 請考生編寫函數(shù) chg(char *s)實現(xiàn)程序要求,最后調用函數(shù) readwriteDAT( )把結果輸出到文件 。 include include include include define N 81 void readwriteDAT()。I++) if(s[i]==39。) s[i]=25。amp。A39。Y39。 printf(Enter a string : )。 chg(a)。 } void readwriteDAT() { int i 。 wf = fopen(, w) 。 chg(a) 。 } ★☆ 題目 12(結構體運算題題 ) 已知在文件 中存有 100個產(chǎn)品銷售記錄,每個產(chǎn)品銷售記錄由產(chǎn)品代碼 dm(字符型 4位 ),產(chǎn)品名稱 mc(字符型 10 位 ),單價 dj(整型 ),數(shù)量 sl(整型 ),金額 je(長整型 )五部分組成。 部分源程序存在文件 。 /*產(chǎn)品名稱 */ int dj。 PRO sell[MAX]。 PRO xy。j100。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)。其中:金額 =單價 *數(shù)量計算得出。 請勿改動主函數(shù) main()、讀數(shù)據(jù)函數(shù) ReadDat()和輸出數(shù)據(jù)函數(shù) WriteDat()的內容。 /*單價 */ int sl。 void ReadDat()。 for(i=0。j++) if(strcmp(sell[i].dm,sell[j].dm)0||strcmp(sell[i].dm,sell[j].dm)==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ù)組: a[200], b[200],已定義變量: t 請勿改動數(shù)據(jù)文件 、主函數(shù) main()、讀函數(shù) readDat()和寫函數(shù) writeDat()的內容。iMAX5。amp。} if(flag==1) b[t++]=a[i]。jt。} } void readDat() { int i 。 i MAX 。 } void main() { int i 。 for(i = 0 。 writeDat() 。 fprintf(fp, %d\n, t) 。 fclose(fp) 。 include define MAX 200 int a[MAX], b[MAX], t=0。iMAX。 gw=a[i]%10。amp。 } for(i=0。j++) if (b[i]b[j]) {qw=b[i]。 FILE *fp 。 i++) fscanf(fp, %d, amp。 readDat() 。 i t 。 } writeDat() { FILE *fp 。 for(i = 0 。 } ★☆ 題目 16(字符替換題 ) 函數(shù) ReadDat()實現(xiàn)從文件 xx中,請編制函數(shù) StrCharJR(),其函數(shù)的功能是:以行為單位把字符串中所有字符的 ASCII值右移 4位,然后把右移后的字符 ASCII 值再加上原字符的 ASCII值,得到新的字符仍存入原字符串對應的位置上。 請勿改動主函數(shù) main()、讀數(shù)據(jù)函數(shù) ReadDat()和輸出數(shù)據(jù)函數(shù) writeDat()的內容。 void Wri
點擊復制文檔內容
法律信息相關推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1