-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent_Grades.cpp
More file actions
75 lines (58 loc) · 2.2 KB
/
Copy pathStudent_Grades.cpp
File metadata and controls
75 lines (58 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <iostream>
#include <string>
using namespace std;
struct Ogrenci{
string isim;
int notu;
};
int main(){
int ogrenciSayisi;
cout<<"Kaç öğrenci gireceksiniz? ";
cin>>ogrenciSayisi;
if(ogrenciSayisi <= 0){
cout<<"Geçersiz öğrenci sayısı girdiniz!" <<endl;
return 1;}
Ogrenci* ogrenciler = new Ogrenci[ogrenciSayisi];
for(int i=0; i< ogrenciSayisi; i++){
cout << i + 1 << ". öğrencinin ismini giriniz: ";
cin>>ogrenciler[i].isim;
while(true){
cout<< ogrenciler[i].isim << " adlı öğrencinin notunu giriniz(0-100): ";
cin>>ogrenciler[i].notu;
if(ogrenciler[i].notu >= 0 && ogrenciler[i].notu <= 100){
break;}
else{
cout<< "Geçersiz not! Lütfen 0-100 arası bir değer giriniz." <<endl;}
}
}
int toplam=0;
int enYuksekNot = ogrenciler[0].notu;
int enDusukNot = ogrenciler[0].notu;
string enYuksekIsim = ogrenciler[0].isim;
string enDusukIsim = ogrenciler[0].isim;
for(int i=0; i< ogrenciSayisi; i++){
toplam += ogrenciler[i].notu;
if(ogrenciler[i].notu > enYuksekNot){
enYuksekNot = ogrenciler[i].notu;
enYuksekIsim = ogrenciler[i].isim;}
if(ogrenciler[i].notu < enDusukNot){
enDusukNot = ogrenciler[i].notu;
enDusukIsim = ogrenciler[i].isim;}
}
double ortalama = static_cast<double>(toplam)/ogrenciSayisi;
cout<<"\n--- Analiz Sonuçları ---" <<endl;
cout<<"Ortalama not: " << ortalama <<endl;
cout<<"En yüksek not: " << enYuksekNot << " (" << enYuksekIsim << ")" <<endl;
cout<<"En düşük not: " << enDusukNot << " (" << enDusukIsim << ")" <<endl;
cout<<"\nOrtalama üstü öğrenciler:" <<endl;
for(int i=0; i< ogrenciSayisi; i++){
if(ogrenciler[i].notu > ortalama){
cout<< ogrenciler[i].isim << " - " << ogrenciler[i].notu <<endl;}
}
cout<<"\nOrtalama altı öğrenciler:" <<endl;
for(int i=0; i< ogrenciSayisi; i++){
if(ogrenciler[i].notu < ortalama){
cout<<ogrenciler[i].isim << " - " << ogrenciler[i].notu <<endl;}
}
delete[] ogrenciler;
return 0;}