こんにちは私は、入力を求めるプロンプトを表示せずにrandnumberを格納する方法があることを知りたいです。Cランダムな配列の配列
#include<stdio.h>
#include<stdlib.h>
void main() {
int randnum;
int i=0;
int storerand[16]; // storing randnumbers
randnum=rand();
while(i <16){
storerand[i]=randnum; // why is this not storing 16 rand number how can i store 16 randnumbers
i++;
}
return 0;
あなたのループカウンタ 'i'は、あなたのコード内の任意の場所にインクリメントされていないよう。これがあなたのループのために何を意味すると思いますか? – Arc676
16個の値をまったく同じ乱数にするか、各スロットに新しい乱数を生成しますか? – paddy
@paddy異なる数字にすることができます –