NotesWhat is notes.io?

Notes brand slogan

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 listeleme();

class Urun {
public:
// Ürün adı ve üretim tarihi alanları
string urunAdi;
string uretimTarihi;
string sonKullanmaTarihi;
float kaloriGram;
float stokAdet;
float fiyat;



// Veriyi depo.txt dosyasına kaydetme metodu
void kaydet() {
ofstream dosyayaz("depo.txt", ios::app);
dosyayaz << urunAdi << " " << uretimTarihi << " " << sonKullanmaTarihi << " " << kaloriGram << " " << stokAdet << " " << fiyat << endl;
dosyayaz.close();
}



public:
void verSilme(string adi)
{
ifstream dosyaOku("depo.txt", ios::in || ios::out);
ofstream dosyayaz("depoyedek.txt", ios::app);
ifstream dosyaOku2("depoyedek.txt", ios::in);


while (!dosyaOku.eof())
{
dosyaOku >> urunAdi >> uretimTarihi >> sonKullanmaTarihi >> kaloriGram >> stokAdet >> fiyat;
if (urunAdi != adi)
{
dosyayaz << urunAdi << " " << uretimTarihi << " " << sonKullanmaTarihi << " " << kaloriGram << " " << stokAdet << " " << fiyat << endl;
}

}
dosyayaz.close();
int sonuc;
sonuc=remove("depo.txt");

ofstream dosyayaz2("depo.txt");
while (!dosyaOku2.eof())
{
dosyaOku2 >> urunAdi >> uretimTarihi >> sonKullanmaTarihi >> kaloriGram >> stokAdet >> fiyat;
dosyayaz2 << urunAdi << " " << uretimTarihi << " " << sonKullanmaTarihi << " " << kaloriGram << " " << stokAdet << " " << fiyat << endl;
}

dosyayaz2.close();
dosyaOku2.close();

sonuc=remove("depoyedek.txt");


}

public:
void veriGuncelleme(string urunadi)
{
ifstream dosyaOku;
dosyaOku.open("depo.txt", ios::in || ios::out);
ofstream dosyayaz("depoyedek.txt", ios::app);
ifstream dosyaOku2;
dosyaOku2.open("depoyedek.txt", ios::in);


while (!dosyaOku.eof())
{
dosyaOku >> urunAdi >> uretimTarihi >> sonKullanmaTarihi >> kaloriGram >> stokAdet >> fiyat;
if (urunAdi != urunadi)
{
dosyayaz << urunAdi << " " << uretimTarihi << " " << sonKullanmaTarihi << " " << kaloriGram << " " << stokAdet << " " << fiyat << endl;
}
else {
cout << "urun adi: ";
cin >> urunAdi;

cout << "urun uretim tarihi: ";
cin >> uretimTarihi;

cout << "urun sonKullanmaTarihi: ";
cin >> sonKullanmaTarihi;

cout << "urun kaloriGram: ";
cin >> kaloriGram;

cout << "urun stokAdet: ";
cin >> stokAdet;

cout << "urun fiyat: ";
cin >> fiyat;

dosyayaz << urunAdi << " " << uretimTarihi << " " << sonKullanmaTarihi << " " << kaloriGram << " " << stokAdet << " " << fiyat << endl;
}

}
dosyayaz.close();
int sonuc;
sonuc = remove("depo.txt");

ofstream dosyayaz2("depo.txt");
while (!dosyaOku2.eof())
{
dosyaOku2 >> urunAdi >> uretimTarihi >> sonKullanmaTarihi >> kaloriGram >> stokAdet >> fiyat;
dosyayaz2 << urunAdi << " " << uretimTarihi << " " << sonKullanmaTarihi << " " << kaloriGram << " " << stokAdet << " " << fiyat << endl;
}

dosyayaz2.close();
dosyaOku2.close();

sonuc = remove("depoyedek.txt");


}


public:
void raporalma()
{
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();
}


};


class yemekCesidi {
private:
string yemekAdi;
string malzeme;

public:
void kaydet()
{
char secenek;
ofstream dosyayaz("yemekcesidi.txt", ios::app);
ofstream dosyayaz2("malzeme.txt", ios::app);

cout << "yemek adini giriniz: ";
cin >> yemekAdi;
dosyayaz << yemekAdi << endl;
dosyayaz2 << yemekAdi<<" ";
do
{
cout << "yemegin malzemesini giriniz: ";
cin >> malzeme;
dosyayaz2 << malzeme<<" ";
cout << "malzememe eklemek istiyorsanız e ye basınız eklemek istemiyorsnaız h ye basınız";
cin >> secenek;

} while (secenek!='h');
dosyayaz2 << endl;

dosyayaz.close();
dosyayaz2.close();
}

public:
void yemekCesidSilme(string adi)
{

ifstream dosyaOku("yemekcesidi.txt", ios::in || ios::out);
ifstream dosyaOku2("malzemeler.txt", ios::in || ios::out);

ofstream dosyayaz("yemekcesidiyedek.txt", ios::app);
ofstream dosyayaz2("malzemeleryedek.txt", ios::app);

ifstream dosyaOku3("yemekcesidiyedek.txt", ios::in || ios::out);
ifstream dosyaOku4("malzemeleryedek.txt", ios::in || ios::out);





while (!dosyaOku.eof())
{
dosyaOku >> yemekAdi;
if (yemekAdi != adi)
{
dosyayaz << yemekAdi << endl;
}

}
dosyayaz.close();


while (!dosyaOku2.eof())
{
dosyaOku2 >> yemekAdi>> malzeme;
if (yemekAdi != adi)
{
dosyayaz2 << yemekAdi << malzeme<<endl;
}

}
dosyayaz2.close();

int sonuc;
sonuc = remove("yemekcesidi.txt");


ofstream dosyayaz3("yemekcesidi.txt");
while (!dosyaOku3.eof())
{
dosyaOku3 >> yemekAdi;
dosyayaz3 << yemekAdi << endl;
}

dosyayaz3.close();
dosyaOku3.close();

sonuc = remove("yemekcesidiyedek.txt");

sonuc = remove("malzeme.txt");


ofstream dosyayaz4("malzeme.txt");
while (!dosyaOku4.eof())
{
dosyaOku4 >> yemekAdi >> malzeme;
dosyayaz4 << yemekAdi << malzeme << endl;
}

dosyayaz4.close();
dosyaOku4.close();

sonuc = remove("malzemeleryedek.txt");


}

public:
void yemekCesidiRapoAlma()
{
ifstream dosyaOku;
dosyaOku.open("yemekcesidi.txt", ios::in);


while (!dosyaOku.eof())
{
dosyaOku >> yemekAdi;
cout << yemekAdi << endl;
}

dosyaOku.close();
}
};





int main() {
// Sınıf nesnesi oluşturma ve veri kaydetme
Urun urun1;

/* urun1.urunAdi = "domates";
urun1.uretimTarihi = "2002";
urun1.sonKullanmaTarihi = "2005";
urun1.kaloriGram = 2;
urun1.stokAdet = 0;
urun1.fiyat = 12;
urun1.kaydet();

urun1.urunAdi = "yumurta";
urun1.uretimTarihi = "2002";
urun1.sonKullanmaTarihi = "2005";
urun1.kaloriGram = 0;
urun1.stokAdet = 5;
urun1.fiyat = 2;
urun1.kaydet();*/

/* urun1.verSilme("domates");*/
/* urun1.veriGuncelleme("domates");*/
/*urun1.raporalma();*/
yemekCesidi yemek;
/*yemek.kaydet();*/
yemek.yemekCesidSilme("makarna");


return 0;
}

     
 
what is notes.io
 

Notes.io is a web-based application for 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 12 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

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.