C++:
#include <iostream.h>
#include <conio.h>
#include <fstream.h>
#include <iomanip.h>
int gun,ay,yil,biz,onlar,kontrol=0;
char saha;
void kayit()
{
int kayitSayisi,i;
cout<<"dosyaya kac kayit yapilacak ?"<<endl;
cin>>kayitSayisi;
ofstream futbol;
futbol.open("skor.txt",ios::out);
for(i=0;i<kayitSayisi; i++)
{
cout<< " verileri giriniz ?"<<endl;
cin>>gun>>ay>>yil>>saha>>biz>>onlar;
futbol << gun<<setw(3)<<setw(3)<<ay<<setw(3)<<yil<<setw(3)<<saha<<setw(3)<<biz<<setw(3)
<<onlar<<setw(3)<<endl;
}
futbol.close();
getch();
}
void kayitIlave()
{
int ilaveKayit,i;
cout<<"dosyaya kac kayit ilave edilecek ?"<<endl;
cin>>ilaveKayit;
ofstream futbol;
futbol.open("skor.txt",ios::app);
for(i=0;i<ilaveKayit; i++)
{
cout<< " verileri giriniz ?"<<endl;
cin>>gun>>ay>>yil>>saha>>biz>>onlar;
futbol << gun<<ay<<yil<<saha<<biz<<onlar<<endl;
}
futbol.close();
getch();
}
void liste()
{
clrscr();
ifstream futbol;
futbol.open("skor.txt",ios::in);
while(futbol>>gun>>ay>>yil>>saha>>biz>>onlar)
{
cout<< gun<<ay<<yil<<saha<<biz<<onlar<<endl;
cout<endl;
}
futbol.close();
getch();
}
void silme()
{
int silinecekYil;
clrscr();
cout<<"silinecek yil giriniz "<<endl;
cin>>silinecekYil;
ifstream futbol;
futbol.open("skor.txt",ios::in);
ofstream gecici;
gecici.open("gecici.txt",ios::out);
while(futbol>>gun>>ay>>yil>>saha>>biz>>onlar)
{
if(silinecekYil!=yil)
{
gecici << gun<<ay<<yil<<saha<<biz<<onlar<<endl;
}
}
futbol.close();
gecici.close();
// copy temp to milan
ifstream f1("gecici.txt");
ofstream f2("skor.txt");
f2<<f1.rdbuf();
}
void sorgu()
{int yilAra;
cout<<"hangi yila ait kayitlari araniyor ?"<<endl;
cin>>yilAra;
ifstream futbol;
futbol.open("skor.txt",ios::in);
while(futbol>>gun>>ay>>yil>>saha>>biz>>onlar )
{
if(yilAra==yil)
cout<< gun<<ay<<yil<<saha<<biz<<onlar<<endl;
}
futbol.close();
getch();
}
void menu()
{
int secim;
clrscr();
while(kontrol==0)
{
cout<<"[1] - Kayit " <<endl;
cout<<"[2] - Kayit Ilave " <<endl;
cout<<"[3] - Silme " <<endl;
cout<<"[4] - Liste " <<endl;
cout<<"[5] - sorgu " <<endl;
cout<<"[6] - Cikis " <<endl;
cout<<"Seciminiz:"<<endl;
cin>>secim;
if(secim==1) kayit();
if(secim==2) kayitIlave();
if(secim==3) silme();
if(secim==4) liste();
if(secim==5) sorgu();
if(secim==6) kontrol=1;
else menu();
}
}
void main()
{
menu();
}