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
我覺得一開始都是這樣的~慢慢來吧
不過第五題我也弄不出來~下面是我編譯錯誤的訊息啦~~有人可以幫我看一下嗎 ?? 謝囉~^^"
|