hi all
can anyone please help me with this error.code was working properly earlier giving appropritae results before addign the functions :
assign_ordersize();
user_data.printodsize();
this is my code :
#include <iostream.h>
#include <stdlib.h>
#include <time.h>
//using namespace std;
class data
{
int Machno,Lotn;
int *lots,*wl;
int **ordersinM;
//int *wl;
int *JM;
int totalotsz;
int totalodsz;
public:
void initvalues()
{
int i;
cout<<"Enter the number of lots being processed";
cin>>Lotn;
cout<<"Enter the number of EDS lines in the system";
cin>>Machno;
JM = (int *) malloc(Machno);
for(i=0;i<Machno;i++) {
cout<<"Order for line "<<i;
cin>>JM[i]; }
}
int getnoflots()
{
return Lotn;
}
void ass_lotsize()
{
int i,temp;
totalotsz=0;
wl = (int*) malloc(Lotn);
srand(time(NULL));
for(i=0;i<Lotn;i++) {
//do {
temp = rand()%10 * 5;
//}while(temp!=0);
wl[i] = temp;
totalotsz=+temp;}
cout<<"totallot size : "<<totalotsz;
}
int maxJM()
{
int max = 0;
int i;
for(i=0;i<Machno;i++)
if(JM[i] > max)
max = JM[i];
return max;
}
int * accesslotsize(){
return wl;
}
void assign_ordersize()
{
int i,j;
int temp;
totalodsz=0;
ordersinM = (int **)malloc(Machno*maxJM()*sizeof(int));
for(i=0;i<Machno;i++)
{
for(j=0;j<maxJM();j++)
{
//do {
temp = rand()%100;
//}while(temp!=0); */
ordersinM[i][j]=temp;
totalodsz =+ temp;
}
}
cout<<"total order for all the lines "<<totalodsz;
}
void printodsize()
{
int i,j;
cout<<"Order size generated are :"<<endl;
for(i=0;i<Machno;i++)
{
for(j=0;j<maxJM();j++)
{
cout<<"line "<<i<<" order "<<j<<" : "<<ordersinM[i][j];
cout<<endl;
}
}
}
};
void main()
{
class data user_data;
int *uwl;
int i, temp,limit;
user_data.initvalues();
cout<<"these are the lot sizes"<<endl;
user_data.ass_lotsize();
uwl = user_data.accesslotsize();
limit = user_data.getnoflots();
for(i=0;i<limit;i++)
cout<<uwl[i]<<endl;
user_data.assign_ordersize();
cout<<"i m not reading this";
user_data.printodsize();
}