Witam,
mam następujacy kod
main.cpp
#include "lista.h"
using namespace std;
int main()
{
LISTA l1;
int Tablica[n] = {5, 10, 15, 20, 25, 30, 35, 40, 45, 50};
for(int i=0; i < n; i++)
{
OBIEKT *nowy = new OBIEKT;
nowy->wartosc = Tablica[i];
l1.dorzuc(nowy);
}
return 0;
}
lista.h
const int n = 10;
typedef struct el
{
int wartosc;
struct el *nastepny;
}OBIEKT;
class LISTA
{
public:
void dorzuc(OBIEKT *q);
void wyswietl(OBIEKT *q);
private:
typedef struct
{
OBIEKT *head;
OBIEKT *tail;
}WSK;
WSK dane;
};
lista.cpp
#include "lista.h"
#include <iostream>
using namespace std;
void LISTA::dorzuc(OBIEKT *q)
{
if(dane.head == NULL)
dane.head = dane.tail = q;
else
{
(dane.tail)->nastepny = q;
dane.tail = q;
}
}
Kompiluje program i gdy chce go uruchomić wyświetla że program przestał działać.
Nie wiem o co tutaj chodzi, i zwracam się z prośbą o pomoc.
Shalom