Vehicle file attached.

This is a discussion on Vehicle file attached. within the C++ Programming forums, part of the General Programming Boards category; Here you go. I had to attach the vehicle.h file to a vehicle.cpp file because of the rules for attachments. ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    10

    Smile Vehicle file attached.

    Here you go. I had to attach the vehicle.h file to a vehicle.cpp file because of the rules for attachments. Anyway, it should be a .h file.
    Attached Files Attached Files
    Thanks,
    RJ

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    10

    by the way

    I took off the #endif and left it as the original.
    Thanks,
    RJ

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,671
    > I took off the #endif and left it as the original.
    But that's the whole point - you will get

    .... unterminated '#if" conditional

    If you don't have an #endif to match it.

    Now put the #endif back in, recompile it, and IF you still get a problem, upload the file you most recently compiled with, and the error message you got.

    Sampled history is no use.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    Sep 2001
    Posts
    10

    Thumbs up No problemo

    I'll do that right now.
    Thanks,
    RJ

  5. #5
    Registered User
    Join Date
    Sep 2001
    Posts
    10

    Question Not for nothing

    not for nothing but I did attempt to compile the program but it gave me the same error before and after I added the #endif. It will not complete run.

    See the actual code below: (maybe I missing something and do apologize in advance) but I will also post the dev file itself, as well.
    Thanks again.


    Vehicle.h code:

    / header file - vehicle
    #include<iostream.h>
    #ifndef VEHICLE_H
    #define VEHICLE_H

    class vehicle //base class declaration
    {

    private:
    int itsDoors;
    int itsCylinders;
    int itsEngineSize;
    int itsWheels;
    float wheelWeight;

    };

    void InputCarInfo (vehicle buildCar)
    {
    cout << "How many doors would you like.\n";
    cin >> buildCar.itsDoors;
    cout << "How many cylinders do you want\n";
    cin >> buildCar.itsCylinders;
    cout << "How many wheels do you need on the vehicle\n\n";
    cin >> buildCar.itsWheels;
    }

    void DisplayCarInfo (vehicle yourCar)
    {
    cout << "The vehicle you built has " << yourCar.itsDoors << " doors, " << yourCar.itsCylinders << " cylinders, and " << yourCar.itsWheels << " wheels.\n";
    }
    #endif //This would be the latest code that still doesn't execute.
    Attached Files Attached Files
    Thanks,
    RJ

  6. #6
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    Your upload doesn't work, but I tested your last posted code in Dev C++ and adding an #endif removes the unterminated '#if" error, but your class is wrong.

    In your functions you have attempted to access private data from the class. Unless these functions are members of the class they will not be able to access that information.

    So you need to declare these functions as public members of your class. Alternatively you could make all yuour existing class data public, but I think that would defeat the point of what you are trying to do.

  7. #7
    Registered User
    Join Date
    Sep 2001
    Posts
    10

    Smile Hmm..

    How did you get it to take out the error? I'm still getting the error when I compile the program. Could you please post what you did to the code? I would very much appreciate it.

    Thanks for all your help.
    Thanks,
    RJ

  8. #8
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    I tried to compile it from the code you've posted a couple of posts up (the code that includes the #endif), the only thing I changed was one of your comments was missing a /.

  9. #9
    Registered User
    Join Date
    Sep 2001
    Posts
    10

    Wink oh...I'll lookinto my code

    Thanks again.
    Thanks,
    RJ

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 08:19 PM
  2. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM
  3. Hmm....help me take a look at this: File Encryptor
    By heljy in forum C Programming
    Replies: 3
    Last Post: 03-23-2002, 09:57 AM
  4. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 01:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21