-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathogrenci_kayit_sistemi2.cpp
126 lines (110 loc) · 4.12 KB
/
ogrenci_kayit_sistemi2.cpp
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#include <iostream>
#include <vector>
using namespace std;
struct ogrenci{
int no;
string ad;
string soyad;
int yas;
};
int main(int argc, char** argv) {
vector<ogrenci>ogr;
int i = 0;
int secim;
int ogrSayisi;
do{
system("CLS");
cout<<"Ogrenci sistemine hos geldiniz" << endl;
cout<<"Ogrenci eklemek icin : 1" << endl;
cout<<"Ogrenci silmek icin : 2" << endl;
cout<<"Ogrenci gostermek icin : 3" << endl;
cout<<"Ogrenci sisteminden cikmak icin : 4" << endl;
cout<<"Ogrenci bilgilerini düzenlemek icin : 5" << endl;
cin >> secim;
switch (secim) {
case 1:
int sil;
ogr.push_back(ogrenci());
cout << "Ogrenci no: ";
cin >> ogr[ogrSayisi].no;
for (int j = 0; j < ogrSayisi; j++) {
if (ogr[j].no == ogr[ogrSayisi].no) {
sil = ogr[j].no;
cout << "Ayni numaraya sahip ogrenci bulunmamali." << endl;
ogr.pop_back();
cin.ignore();cin.get();
break;
}
}
if (ogr[ogrSayisi].no != sil) {
cin.ignore();
cout << "Ogrenci ad: ";
getline(cin, ogr[ogrSayisi].ad);
cout << "Ogrenci soyad: ";
getline(cin, ogr[ogrSayisi].soyad);
cout << "Ogrenci yas: ";
cin >> ogr[ogrSayisi].yas;
ogrSayisi++;
}
break;
case 2:
if (ogrSayisi > 0) {
int numara;
cout << "Sistemden silmek istediginiz ogrencinin numarasini giriniz: ";
cin >> numara;
for (int d = 0; d < ogrSayisi; d++) {
if (ogr[d].no == numara) {
ogr.erase(ogr.begin() + d); // Silme iþlemi
ogrSayisi--;
cout << "Ogrenci silindi." << endl;
cin.ignore();cin.get();
break;
}
}
} else {
cout << "Silinecek ogrenci bulunmamaktadir." << endl;
cin.ignore();cin.get();
}
break;
case 3:
if (ogrSayisi > 0) {
for (int i = 0; i < ogrSayisi; i++) {
cout << "Ogrenci No: " << ogr[i].no << endl;
cout << "Ogrenci Ad: " << ogr[i].ad << endl;
cout << "Ogrenci Soyad: " << ogr[i].soyad << endl;
cout << "Ogrenci Yas: " << ogr[i].yas << endl;
cout << "--------------------------" << endl;
cin.ignore(); cin.get();
}
} else {
cout << "Gosterilecek ögrenci bulunmamaktadir." << endl;
cin.ignore();cin.get();
}
break;
case 4:
cout << "Ogrenci sisteminden cykyldy." << endl;
cin.ignore();cin.get();
break;
case 5:
cout << "Ogrenci no: ";
cin >> ogr[ogrSayisi].no;
for (int j = 0; j < ogrSayisi; j++) {
if (ogr[j].no == ogr[ogrSayisi].no) {
cin.ignore();
cout << "Ogrenci ad: ";
getline(cin, ogr[j].ad);
cout << "Ogrenci soyad: ";
getline(cin, ogr[j].soyad);
cout << "Ogrenci yas: ";
cin >> ogr[j].yas;
ogrSayisi++;
}
}
break;
default:
cout << "Gecersiz secim. Lütfen tekrar deneyin." << endl;
cin.ignore();cin.get();
}
}while(secim != 4);
return 0;
}