Hi all!
I have just started learning c++ and i have a lil' problem compiling one of my programs (ADT).
I havent finished it yet and started partialy verifying it, if it's correct or not, but i just met an error and i have no idea what the hell is wrong because i compiled it on other computers and it gives no errors there. Maybe someone can help.
***header file
typedef struct
{int maxnr;
int n;
int *a;
}VE;
void init(VE&,int,int);
void readseq(VE&);
void printseq(VE);
***modul
#include "m3.h"
#include "iostream.h"
#include "conio.h"
void init(VE& x,int maxe,int nre)
{x.maxnr=maxe;
x.n=nre;
x.a=new int[maxe];
}
void readseq(VE& x)
{int db=0;
int y;
VE q;
cout<<db<<".element: ";
cin>>y;
while (y>=0)
{db++;
init(q,db,db);
for (int i=0;i<db;i++)
{q.a[i]=x.a[i];}
q.a[db]=y;
x=q;
delete [] q.a;
cout<<db<<".element: ";
cin>>y;
}
}
void printseq(VE x)
{for (int i=0;i<x.n;i++)
{cout<<"x["<<i<<"] = "<<x.a[i]<<endl;}
}
***main
#include "m3.h"
#include "iostream.h"
#include "conio.h"
void main()
{ VE z;
readseq(z);
printseq(z);
getch();
}
Error messages in line 7 and 8 in the header file.