Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C++ by Mateusz ( 14 years ago )
#include <iostream>
#include <string>
using namespace std;
struct osoba
{
osoba* wsk;
string imie;
string nazwisko;
};
void dodaj_osobe(osoba*& head, string im, string nazw)
{
if (head==NULL)
{
head=new osoba;
head->imie=im;
head->nazwisko=nazw;
head->wsk=NULL;
}
else
{
osoba* i=head;
while (i->wsk != NULL)
i=i->wsk;
i->wsk=new osoba;
i->wsk->imie=im;
i->wsk->nazwisko=nazw;
i->wsk->wsk=NULL;
}
}
int main()
{
string imie, nazwisko;
int opcja;
osoba* h=new osoba;
cout<<"Wybierz z listy ponizej: "<<endl;
cout<<"1. Dodaj osobe do listy."<<endl;
cout<<"2. Usun osobe z listy."<<endl;
cout<<"3. Wyswietl liste."<<endl;
cin>>opcja;
switch(opcja)
{
case 1:
{
cout<<"Podaj imie: ";
cin>>imie;
cout<<"Podaj nazwisko: ";
cin>>nazwisko;
dodaj_osobe(h, imie, nazwisko);
}
}
}
Revise this Paste
Parent: 44027