VC++わかる人
最新 最初 全
#40 [rudy]
うん(´∀`)
ってか、下のを丸ごと写してww
void ALL_TOTAL_AVE(int *arr1, int *arr2, int *arr3)
{
float total = 0; /*floatに*/
int count = 0;
int i;
for (i=0; i<5; i++) {
total += arr1[i];
count++;
}
for (i=0; i<5; i++) {
total += arr2[i];
count ++;
}
for (i=0; i<5; i++) {
total += arr3[i];
count++;
}
printf("全ての合計:%d\n",(int)total); /*int型へキャスト変換*/
printf("全ての平均:%f\n",total/count);
}
:07/07/22 19:38 :PC :GG4r0F5E
#41 [えり]
ALL_TOTAL_AVE(G1,G2,G3);
void ALL_TOTAL_AVE(int *arr1, int *arr2, int *arr3)
{
float total = 0; /*floatに*/
int count = 0;
int i;
for (i=0; i<5; i++) {
total += arr1[i];
count++;
}
for (i=0; i<5; i++) {
total += arr2[i];
count ++;
}
for (i=0; i<5; i++) {
total += arr3[i];
count++;
}
printf("全ての合計:%d\n",(int)total); /*int型へキャスト変換*/
printf("全ての平均:%f\n",total/count);
}
return 0;
}
こんな感じですか?
:07/07/22 19:43 :PC :bUxWvbe.
#42 [rudy]
うん。
だけど・・・return 0;はいらないよ(´∀`)
:07/07/22 20:05 :PC :GG4r0F5E
#43 [えり]
:07/07/22 20:20 :SH903i :kZazB9Ss
#44 [えり]
rudyさんいますか
:07/07/23 13:34 :SH903i :bBrN96u.
#45 [えり]
コマンドプロンプト?で
読み込んだんですけど
void ALL_TOTAL_(int *arr1, int *arr2, int *arr3) ←ここでは宣言できない
} ←宣言の構文エラー
あと1番最後の…
} ←エラー:宣言に;がない
警告:関数は値を返すべき
エラー:不要な}
って出てきてしまうんです
どしたらいいでしょうか
:07/07/23 14:57 :SH903i :bBrN96u.
#46 [rudy]
面倒くさいからメールしてくれい(´・ω・`)
:07/07/23 15:16 :PC :DExr8d0M
#47 [名前未登録]
整数a、bの最大公約数を求めるプログラミングを教えてください。いまの自分のC言語の力ではわからなくて困っています…
:07/07/24 02:53 :W41CA :jBhYxc8Q
#48 [rudy]
:07/07/24 16:27 :W42S :urpy36f.
#49 [rudy]
おまたせ(´∀`)
#include<stdio.h>
int gcb(int x,int y)
{
int t;
while (y != 0) {
t = x%y;
x = y;
y = t;
}
return x;
}
int main()
{
int x,y;
int answer;
putchar('>');
scanf("%d",&x);
putchar('>');
scanf("%d",&y);
printf("%dと%dの最大公約数は%dです\n", x, y, gcb(x,y));
return 0;
}
:07/07/24 18:51 :PC :W2qLgq1o
★コメント★
←次 | 前→
トピック
C-BoX E194.194