run time error

Discussion in 'C++' started by icechef, Feb 21, 2009.

  1. icechef

    icechef New Member

    Joined:
    Feb 21, 2009
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    keep getting a run time error failure to intialise, I know what it means but just cant solve it any ideas?
     
  2. icechef

    icechef New Member

    Joined:
    Feb 21, 2009
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
  3. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Anything more you would like to share about the error ?
     
  4. icechef

    icechef New Member

    Joined:
    Feb 21, 2009
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    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
     
  5. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    You haven't set HD to point to anything.
    What compiler are you using?
     
  6. icechef

    icechef New Member

    Joined:
    Feb 21, 2009
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    Visual express
    how do you do that?
     
  7. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    Same way you did it for A.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice