Notes
Notes - notes.io |
// deneme po1.cpp : Bu dosya 'main' işlevi içeriyor. Program yürütme orada başlayıp biter.
//
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
void menu();
void yemekPisir();
void islemler();
void depoIslemleri();
void yemekCesitIslemleri();
class Urun {
private:
// Ürün adı ve üretim tarihi alanları
string urunAdi;
string uretimTarihi;
string sonKullanmaTarihi;
float kaloriGram;
float stokAdet;
float fiyat;
public:
// Veriyi depo.txt dosyasına kaydetme metodu
void depoUrunKaydet() {
ofstream depoyaz("depo.txt", ios::app);
ifstream depooku("depo.txt", ios::in);
string line;
if (depoyaz.is_open())
{
cout << "urun adini giriniz: ";
cin >> urunAdi;
cout << "urun uretim tarihini giriniz: ";
cin >> uretimTarihi;
cout << "urun son tuketim tarihin giriniz: ";
cin >> sonKullanmaTarihi;
cout << "urun kaç kilogram giriniz eğer adet ise 0 (sıfır) yazınız: ";
cin >> kaloriGram;
cout << "urun adet giriniz eğer kilogram girdiyseniz 0(sıfır) yazınız: ";
cin >> stokAdet;
cout << "urun fiyat giriniz:";
cin >> fiyat;
depoyaz << urunAdi << " " << uretimTarihi << " " << sonKullanmaTarihi << " " << kaloriGram << " " << stokAdet << " " << fiyat << endl;
}
else
{
cout << "dosya acılamadı";
}
depoyaz.close();
cout << "urun kayıt edildi" << endl;
}
public:
void depoUrunSilme(string adi)
{
ifstream depoOku("depo.txt", ios::in || ios::out);
ofstream depoyedekyaz("depoyedek.txt", ios::app);
ifstream dosyaOku2("depoyedek.txt", ios::in);
while (!depoOku.eof())
{
depoOku >> urunAdi >> uretimTarihi >> sonKullanmaTarihi >> kaloriGram >> stokAdet >> fiyat;
if (urunAdi != adi)
{
depoyedekyaz << urunAdi << " " << uretimTarihi << " " << sonKullanmaTarihi << " " << kaloriGram << " " << stokAdet << " " << fiyat << endl;
}
}
depoyedekyaz.close();
int a = remove("depo.txt");
int b = rename("depoyedek.txt", "depo.txt");
cout << "urun silindi" << endl;
}
public:
void depoUrunGuncelleme(string urunadi)
{
ifstream depoOku("depo.txt", ios::in || ios::out);
ofstream depoyaz("depoyedek.txt", ios::app);
ifstream dosyaOku2("depoyedek.txt", ios::in);
string line;
while (!depoOku.eof())
{
depoOku >> urunAdi >> uretimTarihi >> sonKullanmaTarihi >> kaloriGram >> stokAdet >> fiyat;
if (urunAdi != urunadi)
{
depoyaz << urunAdi << " " << uretimTarihi << " " << sonKullanmaTarihi << " " << kaloriGram << " " << stokAdet << " " << fiyat << endl;
}
else {
cout << "urun adini giriniz: ";
cin >> urunAdi;
cout << "urun uretim tarihini giriniz: ";
cin >> uretimTarihi;
cout << "urun son tuketim tarihin giriniz: ";
cin >> sonKullanmaTarihi;
cout << "urun kaç kilogram giriniz eğer adet ise 0 (sıfır) yazınız: ";
cin >> kaloriGram;
cout << "urun adet giriniz eğer kilogram girdiyseniz 0(sıfır) yazınız: ";
cin >> stokAdet;
cout << "urun fiyat giriniz:";
cin >> fiyat;
depoyaz << urunAdi << " " << uretimTarihi << " " << sonKullanmaTarihi << " " << kaloriGram << " " << stokAdet << " " << fiyat << endl;
}
}
depoyaz.close();
int a = remove("depo.txt");
int b = rename("depoyedek.txt", "depo.txt");
cout << "urun guncellendi " << endl;
}
public:
void depoUrunRapoAlma()
{
ifstream dosyaOku;
dosyaOku.open("depo.txt", ios::in);
while (!dosyaOku.eof())
{
dosyaOku >> urunAdi >> uretimTarihi >> sonKullanmaTarihi >> kaloriGram >> stokAdet >> fiyat;
cout << urunAdi << " " << uretimTarihi << " " << sonKullanmaTarihi << " " << kaloriGram << " " << stokAdet << " " << fiyat << endl;
}
dosyaOku.close();
cout << endl;
}
};
class yemekCesidi {
private:
string yemekAdi;
string malzeme;
int malzemeMiktarKillogram;
int malzemeMiktarAdet;
public:
void yemekCesidiKayit()
{
char secenek;
string line;
ofstream yemekcesidiyaz("yemekcesidi.txt", ios::app);
ifstream yemekcesidioku("yemekcesidi.txt",ios::in);
ofstream malzemeayaz("malzeme.txt", ios::app);
ifstream malzemeyoku("malzeme.txt", ios::in);
cout << "yemek adini giriniz: ";
cin >> yemekAdi;
yemekcesidiyaz << yemekAdi << endl;
do
{
cout << "yemegin malzemesini giriniz: ";
cin >> malzeme;
cout << "kullanılan malzemenin kilogarmı kilogramı yoksa 0(sıfır) yediniz: ";
cin >> malzemeMiktarKillogram;
cout << "kullanılan malzemenin adedi kilogram yazdıysanız 0(sıfır) yediniz: ";
cin >> malzemeMiktarAdet;
malzemeayaz << yemekAdi << " " << malzeme << " " << malzemeMiktarKillogram << " " << malzemeMiktarAdet << endl;
cout << "malzememe eklemek istiyorsanız e ye basınız eklemek istemiyorsnaız h ye basınız: ";
cin >> secenek;
} while (secenek != 'h');
yemekcesidiyaz.close();
malzemeayaz.close();
cout << "yemek cesidi kayıt edildi" << endl;
}
public:
void yemekCesidSilme(string adi)
{
ifstream yemekcesidioku("yemekcesidi.txt", ios::in);
ifstream malzemeoku("malzeme.txt", ios::in);
ofstream yemekcesidiyedekyaz("yemekcesidiyedek.txt", ios::app);
ofstream malzemeyedekyaz("malzemeyedek.txt", ios::app);
while (!yemekcesidioku.eof())
{
yemekcesidioku >> yemekAdi;
if (yemekAdi != adi)
{
yemekcesidiyedekyaz << yemekAdi << endl;
}
}
yemekcesidiyedekyaz.close();
while (!malzemeoku.eof())
{
malzemeoku >> yemekAdi >> malzeme >> malzemeMiktarKillogram >> malzemeMiktarAdet;
if (yemekAdi != adi)
{
malzemeyedekyaz << yemekAdi <<" "<< malzeme <<" "<< malzemeMiktarKillogram <<" "<< malzemeMiktarAdet << endl;
}
}
malzemeyedekyaz.close();
remove("yemekcesidi.txt");
rename("yemekcesidiyedek.txt","yemekcesidi.txt");
remove("malzeme.txt");
rename("malzemeyedek.txt", "malzeme.txt");
cout << "yemek cesidi silindi" << endl;
}
public:
void yemekCesidiGuncelleme(string adi)
{
ifstream yemekcesidioku("yemekcesidi.txt", ios::in);
ifstream malzemeoku("malzeme.txt", ios::in);
ofstream yemekcesidiyedekyaz("yemekcesidiyedek.txt", ios::app);
ofstream malzemeyedekyaz("malzemeyedek.txt", ios::app);
while (!yemekcesidioku.eof())
{
yemekcesidioku >> yemekAdi;
if (yemekAdi != adi)
{
yemekcesidiyedekyaz << yemekAdi << endl;
}
else
{
cout << "yemek adini giriniz: ";
cin >> yemekAdi;
yemekcesidiyedekyaz << yemekAdi << endl;
}
}
yemekcesidiyedekyaz.close();
while (!malzemeoku.eof())
{
malzemeoku >> yemekAdi >> malzeme >> malzemeMiktarKillogram >> malzemeMiktarAdet;
if (yemekAdi != adi)
{
malzemeyedekyaz << yemekAdi << " " << malzeme << " " << malzemeMiktarKillogram << " " << malzemeMiktarAdet << endl;
}
else
{
cout << "yemegin malzemesini giriniz: ";
cin >> malzeme;
cout << "kullanılan malzemenin kilogarmı kilogramı yoksa 0(sıfır) yediniz: ";
cin >> malzemeMiktarKillogram;
cout << "kullanılan malzemenin adedi kilogram yazdıysanız 0(sıfır) yediniz: ";
cin >> malzemeMiktarAdet;
malzemeyedekyaz << yemekAdi << " " << malzeme << " " << malzemeMiktarKillogram << " " << malzemeMiktarAdet << endl;
}
}
malzemeyedekyaz.close();
remove("yemekcesidi.txt");
rename("yemekcesidiyedek.txt", "yemekcesidi.txt");
remove("malzeme.txt");
rename("malzemeyedek.txt", "malzeme.txt");
cout << "yemek cesidi guncellendi" << endl;
}
public:
void yemekCesidiRapoAlma()
{
int i = 1;
ifstream dosyaOku;
dosyaOku.open("yemekcesidi.txt", ios::in);
while (!dosyaOku.eof())
{
dosyaOku >> yemekAdi;
cout <<i<<"-"<< yemekAdi << endl;
i++;
}
dosyaOku.close();
cout << endl;
}
};
int main() {
menu();
return 0;
}
void menu()
{
char secenek;
cout << "1-Yemek pişir " << endl;
cout << "2-islemler için" << endl;
cin >> secenek;
switch (secenek)
{
case '1':
yemekPisir();
break;
case '2':
islemler();
break;
}
}
void yemekPisir()
{
system("cls");
yemekCesidi yemek1;
char secenek;
cout << "Pişirilecek yemeği seciniz" << endl;
yemek1.yemekCesidiRapoAlma();
cin >> secenek;
}
void islemler()
{
system("cls");
char secenek;
cout << "1-depo islemler" << endl;
cout << "2-yemek cesit islemleri" << endl;
cout << "3-menu" << endl;
cin >> secenek;
switch (secenek)
{
case '1':
depoIslemleri();
break;
case '2':
yemekCesitIslemleri();
break;
case '3':
menu();
break;
}
}
void depoIslemleri()
{
char secenek;
Urun urun1;
string urunadi;
cout << "1-depo urun ekle" << endl;
cout << "2-depo urun sil" << endl;
cout << "3-depo urun guncelle" << endl;
cout << "4-depo urun listeleme" << endl;
cout << "5-menu" << endl;
cin >> secenek;
switch (secenek)
{
case '1':
system("cls");
urun1.depoUrunKaydet();
break;
case '2':
system("cls");
urun1.depoUrunRapoAlma();
cout << endl;
cout << "Silinecek urunun adini giriniz: ";
cin >> urunadi;
urun1.depoUrunSilme(urunadi);
urunadi = "";
break;
case '3':
system("cls");
urun1.depoUrunRapoAlma();
cout << endl;
cout << "Guncellenecek urunun adini giriniz: ";
cin >> urunadi;
urun1.depoUrunGuncelleme(urunadi);
break;
case '4':
system("cls");
urun1.depoUrunRapoAlma();
break;
case '5':
islemler();
break;
}
}
void yemekCesitIslemleri()
{
char secenek;
yemekCesidi yemekcesidi1;
string urunadi;
cout << "1-yemek cesidi ekle" << endl;
cout << "2-yemek cesidi sil" << endl;
cout << "3-yemek cesidi guncelle" << endl;
cout << "4-yemek cesidi listeleme" << endl;
cout << "5-menu" << endl;
cin >> secenek;
switch (secenek)
{
case '1':
system("cls");
yemekcesidi1.yemekCesidiKayit();
break;
case '2':
system("cls");
yemekcesidi1.yemekCesidiRapoAlma();
cout << endl;
cout << "Silinecek yemek cesidinin adini giriniz: ";
cin >> urunadi;
yemekcesidi1.yemekCesidSilme(urunadi);
urunadi = "";
break;
case '3':
system("cls");
yemekcesidi1.yemekCesidiRapoAlma();
cout << endl;
cout << "Guncellenecek yemek cesidinin adini giriniz: ";
cin >> urunadi;
yemekcesidi1.yemekCesidiGuncelleme(urunadi);
break;
case '4':
system("cls");
yemekcesidi1.yemekCesidiRapoAlma();
break;
case '5':
islemler();
break;
}
}
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team
