Arkadaşlar c++ da rastgele (random) öğrenci üretip ve rastgele not hesaplaması yapan programı paylaşıyorum. Kodlarda bir sorun yok minGW ile derlendi, ekran çıktısını da sizlerle paylaşıyorum. Umarım işinize yarar.
#include
using namespace std;
int main() {
const int OGR_SAYISI = 50;
const int NOTLAR = 3;
int donguSayisi = 0;
int notlar[OGR_SAYISI][NOTLAR];
int kaldi = 0, gecti = 0, genelToplam = 0;
srand(time(0));
for (int i = 0; i < OGR_SAYISI; i++) / {
cout << i + 1 << ". ogrenci="
" :="
" ";
for (int j = 0; j < notlar - 1; j++) {
notlar[i][j] = rand() % 101; < /notlar-1;j++) <
/i+1<
cout << setw(3) << notlar[i][j]; <
/setw(3)<<notlar[i][j];
}
notlar[i][2] = round(notlar[i][0] * .4 + notlar[i][1] * .6);
genelToplam += notlar[i][2];
cout << setw(5) << notlar[i][2];
if (notlar[i][2] < 50) {
cout << " Kaldi";
kaldi++;
} else {
cout << " Gecti";
gecti++;
} < /setw(5)<<notlar[i][2];
for (int k = 0; k < notlar[i][2] / 2; k++)
cout << '*';
cout << endl;
} < /endl;
cout << "kalan: " << kaldi << " gecen:="
" " << <= ""
"ortalama:="
" " <<= ""
geneltoplam = ""
50.0 f; = "" < /kaldi<
system(“pause”);
return 0;
}
İlk Yorumu Siz Yapın