Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void wczytajDaneZProtokolu(string Protokol1, Student*& pHead1, Przedmiot*& pHead)
- {
- fstream plik;
- plik.open(Protokol1);
- if (plik.good() == 0)
- {
- cout << "Plik jest bledny";
- return;
- }
- else
- {
- Student* pomocniczy;
- Student* nowyStudent;
- Przedmiot* nowyPrzedmiot;
- Przedmiot* pomocPrzedm;
- int n = 0;
- while (!plik.eof())
- {
- if (pHead) {
- pomocPrzedm = pHead;
- while (pomocPrzedm)
- {
- if (pomocPrzedm->Nastepny == nullptr)
- pomocPrzedm = pomocPrzedm->Nastepny;
- else
- break;
- }
- nowyPrzedmiot = new Przedmiot;
- pomocPrzedm->Nastepny = nowyPrzedmiot;
- nowyPrzedmiot->Nastepny = nullptr;
- }
- else
- {
- nowyPrzedmiot = new Przedmiot;
- nowyPrzedmiot->Nastepny = nullptr;
- pHead = nowyPrzedmiot;
- }
- if (pHead->StNast) {
- pomocniczy = pHead->StNast;
- while (pomocniczy)
- {
- if (pomocniczy->pNext == nullptr)
- pomocniczy = pomocniczy->pNext;
- else
- break;
- }
- nowyStudent = new Student;
- pomocniczy->pNext = nowyStudent;
- nowyStudent->pNext = nullptr;
- }
- else
- {
- nowyStudent = new Student;
- nowyStudent->pNext = nullptr;
- pHead->StNast = nowyStudent;
- }
- getline(plik, pHead->Prowadzacy);
- cout << pHead->Prowadzacy;
- getline(plik, pHead->Nazwa);
- cout << pHead->Nazwa;
- plik >> pHead->StNast->Imie >> pHead->StNast->Nazwisko >> pHead->StNast->Nr_Albumu >> pHead->StNast->Ocena >> pHead->StNast->Data;
- cout << pHead->StNast->Imie << " " << pHead->StNast->Nazwisko << " " << pHead->StNast->Nr_Albumu << " " << pHead->StNast->Ocena << " " << pHead->StNast->Data;
- }
- n = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement