Hej! Pytanie pewnie jest banalne, ale nie rozumiem dlaczego ten kod nie działa... Mianowicie, chciałam dodać funkcję "wyswietl" do takiego programu i za bardzo nie wiem co tutaj jest nie tak :|
#include <iostream>
using namespace std;
struct lista
{
int numer;
lista *wsk;
};
void dodaj(lista *&start);
void wyswietl(lista *&start);
int main()
{
lista *start;
start = NULL;
dodaj(start);
wyswietl(lista *&start);
}
void dodaj(lista *&start)
{
lista *wskaznik;
wskaznik = start;
for(int i = 0; i<10; i++)
{
wskaznik = new lista;
cout << "podaj liczbe: ";
cin >> wskaznik->numer;
wskaznik->wsk = start;
start=wskaznik;
}
}
void wyswietl(lista *&start)
{
lista *pomocniczy;
pomocniczy = start;
cout<<"pierwszy numer to: ";
cin>>pomocniczy->numer;
while (pomocniczy->wsk)
{ pomocniczy = pomocniczy->wsk;
cout << "nowy numer to: ";
cin >>5
pomocniczy->numer;
}
}