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

正文內(nèi)容

xxxx春機械設(shè)計制造及其自動化本科(編輯修改稿)

2024-07-27 04:11 本頁面
 

【文章內(nèi)容簡介】 i=1。___(1)___。i++) { for(j=1。j=9。j++) if(j=5i || ___(2)___) cout’ ’。 else ___(3)___。 coutendl。 } }(1) (2) (3) 8. 統(tǒng)計字符串中英文字母個數(shù)的程序。 include int count (char str[])。 void main(){ char s1[80]。 cout ”Enter a line:”。 cin s1。 cout ”count=”count(s1)endl。 } int count(char str[]){ int num=0。 //給統(tǒng)計變量賦初值 for(int i=0。str[i]。i++) if (str[i]=’a’ amp。amp。 str[i]=’z’ ||___(1)___ ) ___(2)___。 ___(3)___。 }(1) (2) (3) 9. 主函數(shù)調(diào)用一個fun函數(shù)將字符串逆序。 include include ___(1)___。 void main( ) { char s[80]。 cins。 ___(2)___。 cout”逆序后的字符串:”sendl 。 } void fun(char ss[]) { int n=strlen(ss)。 for(int i=0。 ___(3)____。 i++) { char c=ss[i]。 ss[i]=ss[n–1–i]。 ss[n–1–i]=c。 } }(1) (2) (3) 10. 從一個字符串中刪除所有同一個給定字符后得到一個新字符串并輸出。 include const int len=20。 void delstr(char a[],char b[],char c)。 void main() { char str1[len],str2[len]。 char ch。 cout輸入一個字符串:。 cinstr1。 cout輸入一個待刪除的字符:。 cinch。 delstr(str1,str2,ch)。 coutstr2endl。 } void delstr(char a[],char b[],char c) { int j=0。 for(int i=0。 ___(1)___。 i++) if(___(2)___) b[j++]=a[i]。 b[j]=___(2)___。 }(1) (2) (3) 四、寫出程序運行結(jié)果 1. include include void main() { int a[8]={25,48,32,85,64,18,48,29}。 int max,min。 max=min=a[0]。 for(int i=0。 i8。 i++) { if(maxa[i]) max=a[i]。 if(mina[i]) min=a[i]。 } coutmax:maxendl。 coutmin:minendl。 } 2. include void main() { int a,b。 for(a=1,b=2。 b50。) { couta39。 39。b39。 39。 a=a+b。 b=a+b。 } coutendl。 couta39。 39。b39。 39。endl。 } 3. include const int M=3, N=4。 void main() { int i,j,s=0。 for(i=1。i=M。i++) for(j=1。j=N。j++) s+=i*j。 cout”s=”sendl。 } 4. include void main() { int a=2,b=5,c=0。 if(a+b10) c=a*b。 else c=3*a+b。 if(c=20) coutc*c。 else cout4+c5。 coutendl。 a=a+b。 b=a+b。c+=a+b。 couta,b,c=a39。,39。b39。,39。cendl。 } 5. include void main() { int x=5。 switch(2*x3) { case 4: coutx’ ’。 case 7: cout2*x+1’ ’。 case 10: cout3*x1’ ’。 break。 default: coutdefaultendl。 } coutswitch end.endl。 } 6. include include int a[4]={36,5,73,8}。 void main() { int i,y。 for(i=0。 i4。 i++) { if(a[i]0) y=1。 else if(a[i]10) y= a[i]* a[i]+3。 else if(a[i]60) y=4*a[i]5。 else y=int(sqrt(a[i]))。 // sqrt(x)為取x的平方根函數(shù) coutsetw(5)a[i]setw(5)y。 } } 7. include int a[8]={36,25,20,43,12,70,66,35}。 void main() { int s0,s1,s2。 s0=s1=s2=0。 for(int i=0。 i8。 i++) { switch(a[i]%3) { case 0: s0+=a[i]。break。 case 1: s1+=a[i]。break。 case 2: s2+=a[i]。break。 } } couts0’ ’s1’ ’s2endl。 } 8. include const int N=5。 void main() { int i,p=1,s=0。 for(i=1。iN。 i++) { p=p*i。 s=s+p。 coutsetw(5)isetw(5)p。 coutsetw(5)sendl。 } } 9. include const int M=20。 void main() { int c2,c3,c5。 c2=c3=c5=0。 for(int i=1。 i=M。 i++) { if(i%2==0) c2++。 if(i%3==0) c3++。 if(i%5==0) c5++。 } coutc239。 39。c339。 39。c5endl。 } 10. include void main() { int i,j。 for(i=0。i5。i++) { for(j=i。j5。j++) cout’*’。 coutendl。 } } 11. include void main() { for(int i=1,s=0。i20。i++) { if(i%2==0 || i%3==0) continue。 couti’ ’。 s+=i。 } coutsendl。 }五、指出程序或函數(shù)的功能 1. include void main() { int i,s=0。 for(i=2。i=30。i+=2) s+=i*i。 couts=sendl。 } 2. include include include void main() { int i=10,a。 while(i0) { a=rand()%90+10。 int j, k=int(sqrt(a)+1e5)。 //sqrt(x)為求x的平方根函數(shù) for(j=2。 j=k。 j++) if(a%j==0) break。 if(jk) {couta39。 39。 i。} } } 3. void trans(int x) { char a[10]。 int i=0,rem。 do { rem=x%16。 x=x/16。 if(rem10) a[i]=48+rem。 //’0’字符的ASCII碼為48 else a[i]=65+rem。 //’A’字符的ASCII碼為65 i++。 }while(x!=0)。 while(i0) couta[i]。 coutendl。 } 4. include double f1(int n) { double sign=1,s=1。 for(int i=2。i=n。 i++) { s+=sign/(i*i)。 sign*=1。 } return s。 } void main() { int a。 cina。 coutf1(a
點擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1