XE7 C++ compile edemedim yardım lütfen

C, C++ ve C++ Builder ile ilgili konuları buraya yazabilirsiniz.
Cevapla
aykacerkan@yahoo.com
Üye
Mesajlar: 4
Kayıt: 17 Mar 2021 09:45

XE7 C++ compile edemedim yardım lütfen

Mesaj gönderen aykacerkan@yahoo.com »

//Bismillahirrahmanirrahim
// ÖğrenciTakip.cpp
//

// ConsoleApplication2.cpp : Bu dosya 'main' işlevi içeriyor. Program yürütme orada başlayıp biter.
//



#include <iostream>
#include <fstream>
#include <string>
#include <stdlib.h>
#include <conio.h>
#include <Windows.h>
#include <System.SysUtils>



#define MAX 150 //Maximum Ogrenci Sayisi
#define MAX2 30 //Maximum Ogretmen Sayisi
#define MAX3 50 //Not Ortalamalarının Ortalaması 94 ten Yüksek olan Ogrenciler
#define DERSAYISI 5 // turlerinKarsiligi daki ders sayisi

using namespace std;

void gorevli_menu();
void ana_menu();
int ogrenci_sayisi = 0;
int ogretmen_sayisi = 0;
int seckin_ogrenci_sayisi = 0;
int sinif_ortalamasi = 0;
string turlerinKarsiligi[DERSAYISI] = {"Türkçe","Matematik" ,"Fizik" , "Tarih" ,"Edebiyat" };

int okulortalamalar[DERSAYISI]; // DERSAYISI kadar derslerin ortalaması
int seckin_ogrenciler_ortalamalar[DERSAYISI]; // DERSAYISI kadar derslerin ortalaması



class Ogrenci
{
public:
string ad, soyad;
int sirano, ogrenci_no;
int notlar[DERSAYISI][3];
int ortalama;
string telno;
string adres;
Ogrenci() {};
void yenikayit(string ad, string soyad, int sira_no, int ogrenci_no, string telno, string adres);

private:

}ogrenciler[MAX], seckin_ogrenciler[MAX3];


void Ogrenci::yenikayit(string a, string s, int n, int on, string tln, string adrs) {
ad = a;
soyad = s;
sirano = n;
ogrenci_no = on;
ortalama = 0;
telno = tln;
adres = adrs;
ogrenci_sayisi++;
}

class Ogretmen
{
public:
string ogretmen_ad, ogretmen_soyad, sifre;
string ders;
int ogretmen_no;
string telno;
string adres;
void ogretmenyenikayit(int, string, string, string, string, string, string);
void ogretmen_menu();
Ogretmen() {};
private:

}ogretmenler[MAX2];

void Ogretmen::ogretmenyenikayit(int n, string a, string s, string d, string pass, string tel, string adrs) {
ogretmen_no = n;
ogretmen_ad = a;
ogretmen_soyad = s;
ders = d;
sifre = pass;
telno = tel;
adres = adrs;
ogretmen_sayisi++;
}

void Ogretmen::ogretmen_menu() {
int secim, n;

system("cls");
cout << "Öğretmen Not Sistemi" << endl;
cout << "---------------------" << endl;
cout << "1.Not Girişi" << endl;
cout << "2.Sınıf Not Ortalaması" << endl;
cout << "3.Öğrenci Listesi" << endl;
cout << "4.Seçkin Öğrenci Listesi" << endl;
cout << "5.Ana Menü" << endl;
secim = _getch();
switch (secim) {
case '1':
system("cls");
cout << "Notunu Gireceğiniz Öğrencinin Sıra Numarsını Girin 1-" << ogrenci_sayisi << " : ";
fflush(stdin);
cin >> n;

for (int c = 0; c < MAX; c++)
{
if (ogrenciler[c].sirano == n)
{

int dersgirissekli, dersno;
system("cls");
do {
cout << "Tek Ders(1) mi Girilecek yoksa Hepsimi(2) ? : ";
fflush(stdin);
cin >> dersgirissekli;
} while (!(dersgirissekli == 1 || dersgirissekli == 2));

for (int d = 0; d < DERSAYISI; d++)
cout << d + 1 << " " << turlerinKarsiligi[d] << " ";
if (dersgirissekli == 1) {

cout << "\nGiriniz Ders No : ";
fflush(stdin);
cin >> dersno;
dersno--;


cout << turlerinKarsiligi[dersno] << "Vize : ";
cin >> ogrenciler[c].notlar[dersno][0];
cout << turlerinKarsiligi[dersno] << "Final : ";
cin >> ogrenciler[c].notlar[dersno][1];

ogrenciler[c].notlar[dersno][2] = ogrenciler[c].notlar[dersno][0] * 3 / 10 + ogrenciler[c].notlar[dersno][1] * 7 / 10; // netice ogrenciler[c].notlar[2]

ogrenciler[c].ortalama = 0;

for (int i = 0; i < DERSAYISI; i++)
ogrenciler[c].ortalama += ogrenciler[c].notlar[2];

ogrenciler[c].ortalama /= DERSAYISI; // öğreci derslerinin ortalaması


if (ogrenciler[c].ortalama > 94) {
seckin_ogrenciler[seckin_ogrenci_sayisi] = ogrenciler[c];
seckin_ogrenci_sayisi++;
}




}

if (dersgirissekli == 2) {
cout << endl;
for (int i = 0; i < DERSAYISI; i++) {
cout << turlerinKarsiligi << "Vize : ";
fflush(stdin);
cin >> ogrenciler[c].notlar[0];
cout << turlerinKarsiligi << "Final : ";
fflush(stdin);
cin >> ogrenciler[c].notlar[1];
}

for (int i = 0; i < DERSAYISI; i++)
ogrenciler[c].notlar[2] = ogrenciler[c].notlar[0] * 3 / 10 + ogrenciler[c].notlar[1] * 7 / 10; // netice ogrenciler[c].notlar[2]

ogrenciler[c].ortalama = 0;

for (int i = 0; i < DERSAYISI; i++)
ogrenciler[c].ortalama += ogrenciler[c].notlar[i][2]; // öğreci derslerinin ortalaması

ogrenciler[c].ortalama /= DERSAYISI;


if (ogrenciler[c].ortalama > 94) {
seckin_ogrenciler[seckin_ogrenci_sayisi] = ogrenciler[c];
seckin_ogrenci_sayisi++;
}

//seçkin ogrenciler ayrı bir nesne dizisine alınıyor
}



cout << "İşlem Başarılı" << endl;


system("pause");
ogretmen_menu();
}
}

cout << "Öğrenci Bulunamadı." << endl;
system("pause");
ogretmen_menu();
break;
case '2':
system("cls");

cout << "Sınıfın Not Ortalaması : \n";
if (ogrenci_sayisi <= 0)
{
cout << "Bu Dersi Alan Öğrenci Yok." << endl;
system("pause");
ogretmen_menu();
}
else
{




for (int i = 0; i < DERSAYISI; i++) {
okulortalamalar[i] = 0;
for (int p = 0; p < ogrenci_sayisi; p++)
okulortalamalar[i] += ogrenciler[p].notlar[i][2];

okulortalamalar[i] /= ogrenci_sayisi;
cout << turlerinKarsiligi[i] << " Sınıf Ortalaması : " << okulortalamalar[i] << endl;

}

system("pause");
ogretmen_menu();
}
break;
case '3':
{

system("cls");
for (int j = 0; j < ogrenci_sayisi; j++)
cout << "Ad : " << ogrenciler[j].ad << "\tSoyad : " << ogrenciler[j].soyad
<< "\tSıra No : " << ogrenciler[j].sirano << "\tNumara : " << ogrenciler[j].ogrenci_no << " Not Ortalaması : " << ogrenciler[j].ortalama << endl;
cout << "Öğrenci Sayısı : " << ogrenci_sayisi << endl;
system("pause");


ogretmen_menu();
}
break;
case '4':
{
system("cls");
for (int j = 0; j < seckin_ogrenci_sayisi; j++)
cout << "Ad : " << seckin_ogrenciler[j].ad << "\tSoyad : " << seckin_ogrenciler[j].soyad
<< "\tSıra No : " << seckin_ogrenciler[j].sirano << "\tOkul No : " << seckin_ogrenciler[j].ogrenci_no << " Not Ortalaması : " <<
seckin_ogrenciler[j].ortalama << endl;
cout << "Seçkin Öğrenci Sayısı : " << seckin_ogrenci_sayisi << endl;
system("pause");

ogretmen_menu();
}
break;
case '5':
{
system("cls");
ana_menu();

}
break;
default: ogretmen_menu();
}
}
void ana_menu() {
system("cls");
int secim, b, num;
string sifre;
string k_id, k_sifre;
cout << "Okul Otomasyonu" << endl;
cout << "---------------" << endl;
cout << "1.Görevli Girişi" << endl;
cout << "2.Öğretmen Girişi" << endl;
cout << "3.Diske Kaydet ve Çık" << endl;
cout << "4.Diskten Yükle" << endl;
cout << "5.Öğrenci Sıra No Dosyası Oluştur " << endl;
cout << "6.Öğretmen Sıra No Dosyası Oluştur " << endl;
cout << "0.Çıkış" << endl;
secim = _getch();
switch (secim)
{
case '1':
system("cls");
cout << "Kullanıcı Adı : ";
cin >> k_id;
if (k_id == "h")
{
cout << "Sifre :";
cin >> k_sifre;
if (k_sifre == "m")
{
gorevli_menu();
}
else
{
cout << "Şifre Yanlış!!!" << endl;
system("pause");
ana_menu();
}
}
else
{
cout << "Hatalı Giriş!!!" << endl;
system("pause");
ana_menu();
}
break;
case '2':
system("cls");
cout << "Öğretmen Numarası Girin : ";
cin >> num;
for (b = (num - 1); b < MAX2; b++) {
if (ogretmenler.ogretmen_no == num) {
cout << "Şifre Girin: ";
cin >> sifre;
if (ogretmenler.sifre == sifre)
{
cout << "Şifre Doğru" << endl;
system("pause");
ogretmenler.ogretmen_menu();
}
else
{
cout << "Şifre Yanlış!!!" << endl;
system("pause");
ana_menu();

}
}
else
{
cout << "Numara Yanlış!!!" << endl;
system("pause");
ana_menu();

}
}
break;
case '3': //diske yaz çık
{
system("cls");
remove("i.txt");
remove("n.txt");

ofstream dosyaogrenci("i.txt");
if (!dosyaogrenci) {
cerr << "Dosya Açılamadı!!!" << endl;
system("PAUSE");
exit(1);
}
for (int i = 0; i < ogrenci_sayisi; i++) {
dosyaogrenci << ogrenciler[i].ad << endl << ogrenciler[i].soyad << endl << ogrenciler[i].sirano << endl
<< ogrenciler[i].ogrenci_no << endl;
for (int j = 0; j < DERSAYISI; j++)
dosyaogrenci << ogrenciler[i].notlar[j][0] << endl << ogrenciler[i].notlar[j][1] << endl << ogrenciler[i].notlar[j][2] << endl;

dosyaogrenci << ogrenciler[i].telno << endl << ogrenciler[i].adres << endl;


}
dosyaogrenci.close();

ofstream dosyaogretmen("n.txt");
if (!dosyaogretmen) {
cerr << "Dosya Açılamadı!!!" << endl;
system("PAUSE");
exit(1);
}
for (int i = 0; i < ogretmen_sayisi; i++) {
dosyaogretmen << ogretmenler[i].ogretmen_ad << endl << ogretmenler[i].ogretmen_soyad << endl
<< ogretmenler[i].sifre << endl << ogretmenler[i].ders << endl << ogretmenler[i].ogretmen_no << endl
<< ogretmenler[i].telno << endl << ogretmenler[i].adres << endl;
}
dosyaogretmen.close();
exit(0);
}
break;
case '4': //diskten yukle
{
system("cls");

ifstream dosyaogrenci("i.txt");
if (!dosyaogrenci) {
cerr << "Dosya Açılamadı!!!" << endl;
system("PAUSE");
exit(1);
}
int i = 0;
string line;

while (dosyaogrenci)
{
getline(dosyaogrenci, ogrenciler[i].ad);
getline(dosyaogrenci, ogrenciler[i].soyad);
getline(dosyaogrenci, line); ogrenciler[i].sirano = StrToInt(line);
getline(dosyaogrenci, line); ogrenciler[i].ogrenci_no = StrToInt(line);

for (int j = 0; j < DERSAYISI; j++) {
getline(dosyaogrenci, line); ogrenciler[i].notlar[j][0] = StrToInt(line);
getline(dosyaogrenci, line); ogrenciler[i].notlar[j][1] = StrToInt(line);
getline(dosyaogrenci, line); ogrenciler[i].notlar[j][2] = StrToInt(line);
}

getline(dosyaogrenci, ogrenciler[i].telno);
getline(dosyaogrenci, ogrenciler[i].adres);


i++;
}
ogrenci_sayisi = --i;
dosyaogrenci.close();

for (int a = 0; a < ogrenci_sayisi; a++)
ogrenciler[a].ortalama = 0;
seckin_ogrenci_sayisi = 0;

for (int c = 0; c < ogrenci_sayisi; c++) {
for (int i = 0; i < DERSAYISI; i++)
ogrenciler[c].ortalama += ogrenciler[c].notlar[i][2]; // netice ogrenciler[c].notlar[i][2]

ogrenciler[c].ortalama /= DERSAYISI;

if (ogrenciler[c].ortalama > 94) {
seckin_ogrenciler[seckin_ogrenci_sayisi] = ogrenciler[c];
seckin_ogrenci_sayisi++;
}
}

// ogrenciler yüklendi!!!

ifstream dosyaogretmen("n.txt");
if (!dosyaogretmen) {
cerr << "Dosya Açılamadı!!!" << endl;
system("PAUSE");
exit(1);
}
int n = 0;
while (dosyaogretmen)
{
getline(dosyaogretmen, ogretmenler[n].ogretmen_ad);
getline(dosyaogretmen, ogretmenler[n].ogretmen_soyad);
getline(dosyaogretmen, ogretmenler[n].sifre);
getline(dosyaogretmen, ogretmenler[n].ders);
getline(dosyaogretmen, line); ogretmenler[n].ogretmen_no = StrToInt(line);
getline(dosyaogretmen, ogretmenler[n].telno);
getline(dosyaogretmen, ogretmenler[n].adres);

n++;
}
ogretmen_sayisi = --n;
dosyaogretmen.close();
cout << "Yükleme Tamamlandı" << endl;
system("pause");
ana_menu();
}
break;
case '5':
{

system("cls");
remove("ogrncsira.txt");

ofstream dosyaogrncsira("ogrncsira.txt");
if (!dosyaogrncsira) {
cerr << "Dosya Açılamadı!!!" << endl;
system("PAUSE");
exit(1);
}
for (int i = 0; i < ogrenci_sayisi; i++)
dosyaogrncsira << ogrenciler[i].sirano << " " << ogrenciler[i].ogrenci_no << " " << ogrenciler[i].ad << " " << ogrenciler[i].soyad << endl;

dosyaogrncsira.close();
cout << "Dosya Oluşturuldu Adı : ogrncsira.txt" << endl;
system("pause");
ana_menu();


}
break;
case '6':
{

system("cls");
remove("ogrtmnsira.txt");

ofstream dosya("ogrtmnsira.txt");
if (!dosya) {
cerr << "Dosya Açılamadı!!!" << endl;
system("PAUSE");
exit(1);
}

for (int n = 0; n < ogretmen_sayisi; n++)
dosya << ogretmenler[n].ogretmen_no << " " << ogretmenler[n].ogretmen_ad << " " << ogretmenler[n].ogretmen_soyad << endl;

dosya.close();
cout << "Dosya Oluşturuldu Adı : ogrtmnsira.txt" << endl;
system("pause");
ana_menu();


}
break;
case '0': exit(0); // diske yazmadan cik
break;
default:
cout << "Hata!!!" << endl;
ana_menu();
}
}

void gorevli_menu() {
int secim, no, ono, aranan,tag=0;
string ad, soyad, ders, sifre, telno, adres;
system("cls");
cout << "Okul Otomasyonu" << endl;
cout << "---------------" << endl;
cout << "1.Yeni Öğrenci Kayıt" << endl;
cout << "2.Öğrenci Kayıt Sil" << endl;
cout << "3.Öğrenci Kayıt Listele" << endl;
cout << "4.Seçkin Öğrenci Kayıt Listele" << endl;
cout << "5.Yeni Öğretmen Kayıt" << endl;
cout << "6.Öğretmen Kayıt Sil" << endl;
cout << "7.Öğretmen Listele" << endl;
cout << "8.Öğrenci Bilgilerini Göster" << endl;
cout << "9.Öğretmen Bilgilerini Göster" << endl;
cout << "a.Ana Menü" << endl;

secim = _getch();
switch (secim)
{
case '1':
system("cls");

cout << "Öğrenci Numaraları 1-" << MAX << " Arasındadır" << endl;

cout << "Ad Girin : ";
fflush(stdin);
cin >> ad;
fflush(stdin);
cout << "Soyad Girin : ";
fflush(stdin);
cin >> soyad;
cout << "Sıra Numara Girin " << ogrenci_sayisi << " ten Sonraki Sayı : ";
fflush(stdin);
cin >> no;
cout << "Öğrenci Okul No Girin : ";
fflush(stdin);
cin >> ono;
cout << "Telefon No Girin : ";
fflush(stdin);
cin >> telno;
cout << "Adres Girin : ";
fflush(stdin);
cin >> adres;



ogrenciler[no - 1].yenikayit(ad, soyad, no, ono, telno, adres);

for (int i = 0; i < DERSAYISI; i++) {
ogrenciler[no - 1].notlar[i][0] = 0; // vize
ogrenciler[no - 1].notlar[i][1] = 0; // final
ogrenciler[no - 1].notlar[i][2] = 0; // netice

}
ogrenciler[no - 1].ortalama = 0;
gorevli_menu();
break;
case '2':
system("cls");
cout << "Silinecek Öğrenci Sıra No Girin :";
fflush(stdin);
cin >> aranan;
for (int j = 0; j < ogrenci_sayisi; j++) {
if (ogrenciler[j].sirano == aranan) {
for (int k = j; k < ogrenci_sayisi; k++) {
ogrenciler[k] = ogrenciler[k + 1];
ogrenciler[k].sirano--;
}
cout << "Kayıt Silindi" << endl;
ogrenci_sayisi--;
system("pause");
gorevli_menu();
}
}
cout << "Kayıt Bulunamadı!!!" << endl;
system("pause");
gorevli_menu();
break;
case '3': //Ogrenci Kayit Listele
system("cls");
for (int j = 0; j < ogrenci_sayisi; j++)
cout << "Ad : " << ogrenciler[j].ad << "\tSoyad : " << ogrenciler[j].soyad
<< "\tSıra No : " << ogrenciler[j].sirano << "\tOkul No : " << ogrenciler[j].ogrenci_no << " Not Ortalaması : " << ogrenciler[j].ortalama << endl;
cout << "Öğrenci Sayısı : " << ogrenci_sayisi << endl;
system("pause");
gorevli_menu();
break;
case '4': //Seckin Ogrenci Kayit Listele
system("cls");
for (int j = 0; j < seckin_ogrenci_sayisi; j++)
cout << "Ad : " << seckin_ogrenciler[j].ad << "\tSoyad : " << seckin_ogrenciler[j].soyad
<< "\tSıra No : " << seckin_ogrenciler[j].sirano << "\tNumara : " << seckin_ogrenciler[j].ogrenci_no << " Not Ortalamasi : " <<
seckin_ogrenciler[j].ortalama << endl;
cout << "Seçkin Öğrenci Sayısı : " << seckin_ogrenci_sayisi << endl;
system("pause");
gorevli_menu();
break;

case '5':
system("cls");
cout << "Büyükten Küçüğe Doğru (Yaşça) Girin" << endl;;
cout << "Ad Girin :";
fflush(stdin);
cin >> ad;
cout << "Soyad Girin :";
fflush(stdin);
cin >> soyad;
cout << "Vereceği Ders :";
fflush(stdin);
cin >> ders;
cout << "Öğretmenler Menüsü Girişinde Kullanilacak Şifre :";
fflush(stdin);
cin >> sifre;
cout << "Öğretmen No " << ogretmen_sayisi << " ten Sonraki Sayı : ";
fflush(stdin);
cin >> no;
cout << "Telefon No Girin :";
fflush(stdin);
cin >> telno;
cout << "Adresi Girin :";
fflush(stdin);
cin >> adres;

ogretmenler[no - 1].ogretmenyenikayit(no, ad, soyad, ders, sifre, telno, adres);
gorevli_menu();
break;
case '6':
system("cls");
cout << "Sıra Numara Girin :";
cin >> aranan;
for (int j = 0; j < ogretmen_sayisi; j++) {
if (ogretmenler[j].ogretmen_no == aranan) {
for (int k = j; k < ogretmen_sayisi; k++) {
ogretmenler[k] = ogretmenler[k + 1];
ogretmenler[k].ogretmen_no--;
}
cout << "Kayıt Silindi" << endl;
ogretmen_sayisi--;
system("pause");
gorevli_menu();
}
}
cout << "Kayıt Bulunamadı!!!" << endl;
gorevli_menu();
break;
case '7':
system("cls");
for (int j = 0; j < ogretmen_sayisi; j++)
cout << "No : " << ogretmenler[j].ogretmen_no << "\tAd : " << ogretmenler[j].ogretmen_ad << "\tSoyad : " <<
ogretmenler[j].ogretmen_soyad << "\tVerdiği Ders : " << ogretmenler[j].ders << endl;
cout << "Öğretmen Sayısı : " << ogretmen_sayisi << endl;
system("pause");
gorevli_menu();
break;
case '8':
system("cls");
cout << "Öğrenci Sıra No Giriniz : ";
fflush(stdin);
cin >> aranan;
for (int j = 0; j < ogrenci_sayisi; j++)
{

if (ogrenciler[j].sirano==aranan)
{
tag = 1;
cout << "Ad : " << ogrenciler[j].ad << "\tSoy Adı : " << ogrenciler[j].soyad << "\tSıra No : " << ogrenciler[j].sirano <<
"\tOkul No : " << ogrenciler[j].ogrenci_no << "\tNot Ortalaması : " << ogrenciler[j].ortalama << endl;

for (int d = 0; d < DERSAYISI; d++)
{
cout << turlerinKarsiligi[d] << "Vize : " << ogrenciler[j].notlar[d][0] << endl;
cout << turlerinKarsiligi[d] << "Final : " << ogrenciler[j].notlar[d][1] << endl;
}
cout << "Tel No: " << ogrenciler[j].telno << endl;
cout << "Adres : " << ogrenciler[j].adres << endl;
break;

}
}
if (tag == 0)
cout << "Öğrenci Bulunamadı!!" << endl;

system("PAUSE");
gorevli_menu();
break;

case '9':
system("cls");
cout << "Öğretmen Sıra No Giriniz : ";
fflush(stdin);
cin >> aranan;
for (int j = 0; j < ogretmen_sayisi; j++)
{

if (ogretmenler[j].ogretmen_no == aranan)
{
tag = 1;
cout << "Ad : " << ogretmenler[j].ogretmen_ad << "\tSoy Adı : " << ogretmenler[j].ogretmen_soyad << "\tSıra No : " <<
ogretmenler[j].ogretmen_no<<"\tDers : "<<ogretmenler[j].ders<<endl;
cout << "Tel No: " << ogretmenler[j].telno << endl;
cout << "Adres : " << ogretmenler[j].adres << endl;
break;

}
}
if (tag == 0)
cout << "Öğretmen Bulunamadı!!" << endl;

system("PAUSE");
gorevli_menu();
break;



case 'a':
ana_menu();
break;
default:
cout << "Hata!!!" << endl;
gorevli_menu();
}
}
void turkcele() {
int codepage = 1254;
SetConsoleOutputCP(codepage); // Windows.h include edilmeli
SetConsoleCP(codepage);

}

int main()
{

turkcele();
ana_menu();
return 0;
}
Cevapla