正在加载图片...
f forg=l;j<i;j++) y=yi-1lj-1+yi-1[: ou<"杨辉三角形:"<<endl for(FO; i<n; i++) forG=0;j=i;j+ cout<<yliik<; 5编程序将输入的字符串删去空格输出。 #includesiostream. h> #include<stdio. h> void maino i char str50]: int F0.j; gets(str); while(str=NULL if(str[=”") while(strIl:=NULL) i strHlFstr[+1; cout<<str<<endl; jfor(i=2;i<n;i++) { for(j=1;j<i;j++) y[i][j]=y[i-1][j-1]+y[i-1][j];} cout<<"杨辉三角形:"<<endl; for(i=0;i<n;i++) { cout<<" "; for(j=0;j<=i;j++) cout<<y[i][j]<<" "; cout<<endl;} } ⒌编程序将输入的字符串删去空格输出。 #include<iostream.h> #include<stdio.h> void main() { char str[50]; int i=0,j; gets(str); while(str[i]!=NULL) { if(str[i]==' ') { j=i; while(str[j]!=NULL) { str[j]=str[j+1]; j++;} } i++;} cout<<str<<endl; }
<<向上翻页
©2008-现在 cucdc.com 高等教育资讯网 版权所有