Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void citire_fisier(string numeFiser)
- {
- ifstream f(numeFiser);
- int marime;
- double pret;
- string nume, brand, material, culoare;
- char tip;
- if (!f) {
- cout << "\n Nu exista fiserul " << numeFiser;
- return;
- }
- while (!f.eof()) {
- f >> tip;
- f >> nume;
- f >> pret;
- if (tip == 'H') {
- f >> culoare;
- f >> marime;
- listaCadou.push_front(new Haina(nume, pret, culoare, marime));
- }
- if (tip == 'B') {
- f >> material;
- listaCadou.push_front(new Bijuteri(nume, pret, material));
- }
- if (tip == 'J') {
- f >> brand;
- listaCadou.push_front(new Jucarie(nume, pret, brand));
- }
- }
- cout << "\n Datele au fost citite cu succes!";
- f.close();
- //else throw "Eroare la citirea din fisier";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement