bballlover
|
分享:
▲
▼
1------------- int main(int argc, char *argv[]) { int n,i=0; char y; scanf("%d\n",&n); scanf("%c\n",&y);
for(i=0;i<n;i++) { printf("%c",y); }
system("PAUSE");
return 0;
}
2---------------------------------------- #include <stdlib.h> #include <stdio.h>
int main(int argc, char *argv[]) { int i=0,n,num=-8;
scanf("%d",&n);
for(i=0;i<n;i++) { printf("%d ",num); num += 3; }
system("PAUSE");
return 0;
}
3--------------------------------------------- #include <stdlib.h> #include <stdio.h>
int main(int argc, char *argv[]) { int i=0,num,grade;
float sum = 0;
scanf("%d",&num);
for(i=0;i<num;i++) { scanf("%d",&grade);
sum = sum + grade; }
printf("%.2f",sum/num);
system("PAUSE");
return 0;
}
-----------------------------------------------4
#include <stdlib.h> #include <stdio.h>
int main(int argc, char *argv[]) { int i=0,a=4,num;
float sum = 0;
scanf("%d",&num);
for(i=0;i<num;i++) { sum = sum + a; a *= -2; }
printf("%f",sum);
system("PAUSE");
return 0;
}
-----------------------------5 #include <stdlib.h> #include <stdio.h>
int main(int argc, char *argv[]) { int num,i; int sw = 1;//用来做正负项转换用的
float sum = 0,a;
scanf("%d",&num);
for(i=1;i<=num;i++) { a = (i+1)/(2i+1) *(i+1)/(2i+1) * sw ; sum = sum + a ; sw *= -1; }
system("PAUSE");
return 0;
}
18 C:\Documents and Settings\Administrator\桌面\新文件2.cpp cannot convert `int __complex__' to `float' in assignment
我觉得一开始都是这样的~慢慢来吧
不过第五题我也弄不出来~下面是我编译错误的讯息啦~~有人可以帮我看一下吗 ?? 谢啰~^^"
|