Witam, proszę o poradę w następującym temacie:
jak zrobić stos w c++ którego elementami będzie struktura danych?
Jeśli chodzi o format stosu to proszę o podpowiedź który będzie w tym przypadku wygodniejszy.
Poniżej kod do którego chciałabym utworzyć stos(Osobny dla struktury Osoba i Ksiazka):
#include <iostream>
#include <string>
#include <conio.h>
#include <cstdlib>
#include <fstream>
struct Osoba{
public:
std::string imie, nazwisko, adres,email;
int rok_ur;
unsigned long int tel;
};
struct Ksiazka{
public:
std::string tytul, autor, wydawnictwo;
int rok_wydania;
};
struct ElementO{
Osoba o ;
struct ElementO next;
};
typedef ElementO wsk, pom;
struct ElementK{
Ksiazka k;
struct ElementK next;
};
typedef ElementK WSK, POM;
int DodajO(Osoba x){
std::cout<<"Podaj imie:"; std::cin>>x->imie;
std::cout<<"Podaj nazwisko:"; std::cin>>x->nazwisko;
std::cout<<"Podaj adres zamieszkania:"; std::cin>>x->adres;
std::cout<<"Podaj email:"; std::cin>>x->email;
std::cout<<"Podaj rok urodzenia:"; std::cin>>x->rok_ur;
std::cout<<"Podaj numer telefonu:"; std::cin>>x->tel;
return 0;
}
int DodajK(Ksiazka y){
std::cout<<"Podaj tytul:"; std::cin>>y->tytul;
std::cout<<"Podaj autor:"; std::cin>>y->autor;
std::cout<<"Podaj wydawnictwo:"; std::cin>>y->wydawnictwo;
std::cout<<"Podaj rok wydania:"; std::cin>>y->rok_wydania;
return 0;
}
void WyswietlOsobe(Osoba x){
std::cout<<"\n "<< x.nazwisko<<" "<<x.imie <<"\n "<<x.adres<<"\n Rok urodzenia: "<<x.rok_ur<<"\n Email: "<<x.email<<"\n Tel: "<<x.tel;
}
void WyswietlKsiazke(Ksiazka y){
std::cout<<" \n"<< y.tytul<<" \n"<<y.autor <<"Wydawnictwo: "<<y.wydawnictwo<<"Rok wydania: \n"<<y.rok_wydania;
}