Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   run time error (http://www.go4expert.com/forums/run-time-error-t16295/)

icechef 21Feb2009 23:50

run time error
 
keep getting a run time error failure to intialise, I know what it means but just cant solve it any ideas?

icechef 22Feb2009 00:03

Re: run time error
 
anybody?

shabbir 22Feb2009 11:30

Re: run time error
 
Anything more you would like to share about the error ?

icechef 22Feb2009 14:12

Re: run time error
 
int main () // This is where the program starts it execution. Itís also the main function
{
char B [25]; // Defines variables
char MBP[25]; // Defines variables
char VCB [25]; // Defines variables
int * HD;
float * P;
float * MBR;
float * MBM;
int * VCX;
int * VCY;
float * VCM; // Defines variables
int X;
int Y;
int Z; // Defines variables
int * A;
//-------------------------------------------------------------------------------------------------
cout << "Enter number of computer specifications required? "; // Displays A Task Title.
cin >> X; // Stores Entered Values.
cout << "You have chosen to set up " << X << " computer specification" << endl;
A =
new (nothrow) int[X];
if (A == 0)
cout <<
"Error";
else
{
for (Y=0; Y<X; Y++) // Starts repeating statemen.
//--------------------------------------------------------------------------------------------------
{
cout <<
"Please Enter Brand? "; // Displays A Task Title.
cin >> B[Y]; // Stores Entered Values.
cout << "Please Enter Hardrive Size? "; // Displays A Task Title.
cin >> HD[Y]; // Stores Entered Values.
cout << "Please Enter Price? "; // Displays A Task Title.
cin >> P[Y]; // Stores Entered Values.
cout << "Please Enter Processor? "; // Displays A Task Title.
cin >> MBP[Y]; // Stores Entered Values.
cout << "Please Enter Motherboard RAM? "; // Displays A Task Title.
cin >> MBR[Y]; // Stores Entered Values.
cout << "Please Enter Motherboard Memory? "; // Displays A Task Title.
cin >> MBM[Y]; // Stores Entered Values.
cout << "Please Enter Graphics Card Brand? "; // Displays A Task Title.
cin >> VCB[Y]; // Stores Entered Values.
cout << "Please Enter X Display? "; // Displays A Task Title.
cin >> VCX[Y]; // Stores Entered Values.
cout << "Please Enter Y Display? "; // Displays A Task Title.
cin >> VCY[Y]; // Stores Entered Values.
cout << "Please Enter Video Card RAM? "; // Displays A Task Title.
cin >> VCM[Y]; // Stores Entered Values.
}
//-----------------------------------------------------------------------------------------------------
{
COMPUTER* pc =
new COMPUTER (B, HD, P, MBP, MBR, MBM, VCB, VCX, VCY, VCM);
//COMPUTER PC(B, HD, P, MBP, MBR, MBM, VCB, VCX, VCY, VCM); PC.show_COMPUTER();
}
cout <<
"What specification would you like to view "; // Displays A Task Title.
cin >> Z;
for (Y=&; Y<Z; Y++)
cout << A[Y] <<
", ";
delete[] A;
{
system(
"pause>nul");
return(0);
}}};
//-------------------------------------------------------------------------------------------------------

The error keep ocuring in this part if the code , when it works it comes upto the point of asking the question about the HD
and
sais failutre to intialize hd runtime error

xpi0t0s 22Feb2009 16:48

Re: run time error
 
You haven't set HD to point to anything.
What compiler are you using?

icechef 22Feb2009 16:55

Re: run time error
 
Visual express
how do you do that?

xpi0t0s 22Feb2009 17:52

Re: run time error
 
Same way you did it for A.


All times are GMT +5.5. The time now is 23:45.