1. Welcome to Tacoma World!

    You are currently viewing as a guest! To get full-access, you need to register for a FREE account.

    As a registered member, you’ll be able to:
    • Participate in all Tacoma discussion topics
    • Communicate privately with other Tacoma owners from around the world
    • Post your own photos in our Members Gallery
    • Access all special features of the site

C++ Menu Driven Program

Discussion in 'Technology' started by tarheelfan_08, Jan 31, 2010.

  1. Jan 31, 2010 at 4:09 PM
    #1
    tarheelfan_08

    tarheelfan_08 [OP] Carolina Alliance

    Joined:
    Jan 4, 2008
    Member:
    #4098
    Messages:
    2,946
    Gender:
    Male
    First Name:
    Justin
    North Carolina
    Vehicle:
    2010 White 4x4 Double Cab Tacoma Short Bed
    Chrome Grill, Chrome accessories(door handles and mirror covers), LEER Super White Cover, Mirrors with Turn Signals, Window Vent Visors, Step Rails, WeatherTech Digital Floor Mats, Mini Maglight Holder, Chrome Bull Bar
    With this program I need to add a menu at the bottom that does the following 9 things.

    1. Choose Service Bay (1-5)

    2. Change make of car in the current Service Bay

    3. Change model of car in the current Service Bay

    4. Change color of car in the current Service Bay

    5. Change year of car in the current Service Bay

    6. Change mileage of car in the current Service Bay

    7. Display car in current service bay

    8. Save

    9. Exit

    Now how will I do the menu part. For instance the very first menu option is choose a service bay(1-5). So once it chooses service bay 1, I should then be able to edit the car information for that service bay based on the next option I choose.

    I know how to do a menu, but I am not sure how to do one with a option such as number one inside of it. If someone could get me started on maybe 1 and 2 I could finish the rest. Or give me some time of example or starting point.



    Code:
    #include <iostream>
    #include <string>
    using namespace std;
    class Car {
    private:
        string make;  //make
        string model; // model
        string color;  // color
        int    year;  // year
        int mileage;  // miles on car
        int service;
    
    public:
        Car(); //constructor
        Car(string, string, string, int ,int, int);
    
        void setMake(string);
        void setModel(string);
        void setColor(string);
        void setYear(int);
        void setMileage(int);
        void setService(int);
        
    
        string getMake();
        string getModel();
        string getColor();
        int getYear();
        int getMileage();
        int getService();
    
        void valid_mileage(int);
        void car_details1();
        void car_details2();
        void car_details3();
        void car_details4();
        void car_details5();
    };
    
    
    //----------------------------------------------------------------
    //class definition..
    Car::Car() {
        make = " ";
        model = " ";
        color = " ";
        year = 0;
        mileage = 0;
    
    }
    
    Car::Car(string make, string model, string color, int year, int mileage, int service) {
        Car::make =  make;
        Car::model = model;
        Car::color = color;
        Car::year = year;
        valid_mileage(mileage);
        Car::service = service;
    }
    
    void Car::setMake(string make) {
        Car::make = make;
    }
    
    void Car::setModel(string model) {
        Car::model = model;
    }
    
    void Car::setColor(string color) {
        Car::color = color;
    }
    
    void Car::setYear(int year) {
        Car::year = year;
    }
    
    void Car::setMileage(int mileage) {
        valid_mileage(mileage);
    }
    
    void Car::setService(int service) {
        Car::service = service;
    }
    
    string Car::getMake() {
        return make;
    }
    string Car::getModel() {
        return model;
    }
    string Car::getColor() {
        return color;
    }
    int Car::getYear() {
        return year;
    }
    int Car::getMileage() {
        return mileage;
    }
    int Car::getService() {
        return service;
    }
    
    void Car::valid_mileage(int mileage) {
        if (mileage>=0)
            Car::mileage=mileage;
        else {
            Car::mileage=0;
            cout << "Warning! Not a valid mileage!\n";
        }
    }
    
    void Car::car_details1() {
        cout << "The current car is a " << year << ' ' << color << ' '
        << make << " with " << mileage << " miles," << " and it is in service bay" << service << "  .\n";
    }
    
    int main() {
    
    
        Car myCar("Ford", "Mustang", "Blue", 2010, 7500, 1);
        myCar.car_details1();
        Car myCar("Toyota", "Tacoma", "White", 1996, 107000, 2);
        myCar.car_details2();
        Car myCar("Nissan", "Altima", "Blue", 2007, 4210, 3);
        myCar.car_details3();
        Car myCar("Honda", "Accord", "Blue", 1999, 97500, 4);
        myCar.car_details4();
        Car myCar("Jeep", "Wrangler", "Blue", 2001, 85000, 5);
        myCar.car_details5();
    
    
        
        
        
        return 0;
    }
    
     
  2. Jan 31, 2010 at 8:29 PM
    #2
    tarheelfan_08

    tarheelfan_08 [OP] Carolina Alliance

    Joined:
    Jan 4, 2008
    Member:
    #4098
    Messages:
    2,946
    Gender:
    Male
    First Name:
    Justin
    North Carolina
    Vehicle:
    2010 White 4x4 Double Cab Tacoma Short Bed
    Chrome Grill, Chrome accessories(door handles and mirror covers), LEER Super White Cover, Mirrors with Turn Signals, Window Vent Visors, Step Rails, WeatherTech Digital Floor Mats, Mini Maglight Holder, Chrome Bull Bar
    Ok everyone here is my final code, I have got it completely written and I am getting some errors with it! And I am not sure if I did it right, but we will find out! Please assist me so that I can get this project done and turned in!! And I really do appreciate all the help guys, I have learned a lot from this project and I plan to talk to the teacher about doing extra stuff so I can catch up to the rest of the class! But regardless, I still got to get through this one project! So please help me!

    Code:
    #include <iostream>
    #include <fstream>
    #include <iomanip>
    #include <functional>
    #include <algorithm>
    #include <string>
    #include <cstdlib>
    
    using namespace std;
    ofstream out;
    
    class Car {
    private:
        string make;  //make
        string model; // model
        string color;  // color
        int bay;    //bay number
        int    year;  // year
        int mileage;  // miles on car
    
    
    
    public:
        Car(); //constructor
        Car(string, string, string, int ,int, int);
    
        void setMake(string);
        void setModel(string);
        void setColor(string);
        void setYear(int);
        void setMileage(int);
    
        
    
        string getMake();
        string getModel();
        string getColor();
        int getYear();
        int getMileage();
    
    
        void valid_mileage(int);
        void car_details();
    
    };
    
    
    //----------------------------------------------------------------
    //class definition..
    Car::Car() {
        make = " ";
        model = " ";
        color = " ";
        year = 0;
        mileage = 0;
    
    }
    
    Car::Car(string make, string model, string color, int year, int mileage, int service) {
        Car::make =  make;
        Car::model = model;
        Car::color = color;
        Car::year = year;
        valid_mileage(mileage);
    
    }
    
    void Car::setMake(string make) {
        Car::make = make;
    }
    
    void Car::setModel(string model) {
        Car::model = model;
    }
    
    void Car::setColor(string color) {
        Car::color = color;
    }
    
    void Car::setYear(int year) {
        Car::year = year;
    }
    
    void Car::setMileage(int mileage) {
        valid_mileage(mileage);
    }
    
    
    string Car::getMake() {
        return make;
    }
    string Car::getModel() {
        return model;
    }
    string Car::getColor() {
        return color;
    }
    int Car::getYear() {
        return year;
    }
    int Car::getMileage() {
        return mileage;
    
    
    void Car::valid_mileage(int mileage) {
        if (mileage>=0)
            Car::mileage=mileage;
        else {
            Car::mileage=0;
            cout << "Warning! Not a valid mileage!\n";
        }
    }
    
    
    
    int main() {
    
    
    
    
        int i;
        const int     NUM_COLS = 5,
                        NUM_ROWS = 5
    
        double bay[NUM_ROWS][NUM_COLS] =             {{"Ford", "Mustang", "Blue", 2010, 7500},
                                                    {"Toyota", "Tacoma", "White", 1996, 107000},
                                                    {"Nissan", "Altima", "Blue", 2007, 4210},
                                                    {"Honda", "Accord", "Blue", 1999, 97500},
                                                    {"Jeep", "Wrangler", "Blue", 2001, 85000}};
        int menu;
    
                
        
        cout << "Car Menu\n\n";            //Menu 
        cout << "1. Choose Service Bay (1-5)\n";
        cout << "2. Change Make of car in the Current Service Bay\n";
        cout << "3. Change Model of car in th current Service Bay\n";
        cout << "4. Change Color of car in the Current Service Bay\n";
        cout << "5. Change Year of car in the Current Service Bay\n";
        cout << "6. Change Mileageof car in the Current Service Bay\n";
        cout << "7. Display Car in Current Service Bay\n";
        cout << "8. Save\n";
        cout << "9. Exit\n\n\n";
        cout << "Please choose one of the above options\n";
        cin >> menu;
        while(menu!=9);//keep on keepin on till they pick exit!
    
                    switch ( menu )
                {
                    case 1: 
                        {
                                cout << " Pick a service Bay (1-5) to edit\n";
                                cin >> bay;
                        }
    
                            break;
                    case 2: 
                            
                        {
                            cout << " The Make of car in the current service bay is:" << make << endl;
                            cout << " Please Enter the change to the make of the car:";
                            cin >> make;
                        }
    
                            break;
                    case 3: 
                            
                        {
                            cout << " The Model of car in the current service bay is:" << make << endl;
                            cout << " Please Enter the change to the model of the car:";
                            cin >> model;
                        }
                            break;
                    case 4:
                        {
                            cout << " The Color of car in the current service bay is:" << make << endl;
                            cout << " Please Enter the change to the color of the car:";
                            cin >> color;
                        }
                            
                            break;
    
                    case 5: 
                        {
                            cout << " The Year of car in the current service bay is:" << make << endl;
                            cout << " Please Enter the change to the year of the car:";
                            cin >> year;
                        }
                            
                            break;
                    case 6: 
                        {
                            cout << " The Mileage of car in the current service bay is:" << make << endl;
                            cout << " Please Enter the change to the mileage of the car:";
                            cin >> mileage;
                        }
                            
                            break;
                    case 7: 
                            void Car::car_details() {
                            cout << "The current car is a " << year << ' ' << color << ' '
                            << make << " with " << mileage << " miles.\n";
                            }
                            break;
                    case 8:
                          out.open("car.txt"); // opens the file
                           if( !out ) { // file couldn't be opened
                              cerr << "Error: file could not be opened" << endl;
                              exit(1);
                           }
    
                          for (i=0; i<5; ++i)
                              out << num[i] << endl;
                           out.close();
    
                            break;
    
                    default:
                        cout << " Please restart the program, you have messed up!!!!"; 
                            break;
    
                }
    
                
    
        
        return 0;
    }
    

    And here are the errors.


    1>------ Build started: Project: Test, Configuration: Debug Win32 ------
    1> test.cpp
    (105): error C2601: 'Car::valid_mileage' : local function definitions are illegal
    (101): this line contains a '{' which has not yet been matched
    (116): error C2601: 'main' : local function definitions are illegal
    (101): this line contains a '{' which has not yet been matched
    (229): fatal error C1075: end of file found before the left brace '{' (101)' was matched
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
     
  3. Jan 31, 2010 at 8:57 PM
    #3
    NetMonkey

    NetMonkey Well-Known Member

    Joined:
    Aug 14, 2008
    Member:
    #8536
    Messages:
    1,725
    Gender:
    Male
    Geogetown, TX
    Vehicle:
    2010, 4x4, DC, off-road, shortbed, automatic
    Toytec Ultimate Lift @ 3", Mickey Thompson MTZ's 285/75/16, Moto Metal 955b, rear 2" ALL, Marlin Crawler sliders
    you are missing a closing curly brace at line 103 :)
     
  4. Jan 31, 2010 at 8:59 PM
    #4
    tarheelfan_08

    tarheelfan_08 [OP] Carolina Alliance

    Joined:
    Jan 4, 2008
    Member:
    #4098
    Messages:
    2,946
    Gender:
    Male
    First Name:
    Justin
    North Carolina
    Vehicle:
    2010 White 4x4 Double Cab Tacoma Short Bed
    Chrome Grill, Chrome accessories(door handles and mirror covers), LEER Super White Cover, Mirrors with Turn Signals, Window Vent Visors, Step Rails, WeatherTech Digital Floor Mats, Mini Maglight Holder, Chrome Bull Bar
    Now that I fixed that....I am getting all of these errors


    1>------ Build started: Project: Test, Configuration: Debug Win32 ------
    1> test.cpp
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(125): error C2144: syntax error : 'double' should be preceded by ';'
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(125): error C2440: 'initializing' : cannot convert from 'const char [5]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(125): error C2440: 'initializing' : cannot convert from 'const char [8]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(125): error C2440: 'initializing' : cannot convert from 'const char [5]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(126): error C2440: 'initializing' : cannot convert from 'const char [7]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(126): error C2440: 'initializing' : cannot convert from 'const char [7]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(126): error C2440: 'initializing' : cannot convert from 'const char [6]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(127): error C2440: 'initializing' : cannot convert from 'const char [7]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(127): error C2440: 'initializing' : cannot convert from 'const char [7]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(127): error C2440: 'initializing' : cannot convert from 'const char [5]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(128): error C2440: 'initializing' : cannot convert from 'const char [6]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(128): error C2440: 'initializing' : cannot convert from 'const char [7]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(128): error C2440: 'initializing' : cannot convert from 'const char [5]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(129): error C2440: 'initializing' : cannot convert from 'const char [5]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(129): error C2440: 'initializing' : cannot convert from 'const char [9]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(129): error C2440: 'initializing' : cannot convert from 'const char [5]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(153): error C2678: binary '>>' : no operator found which takes a left-hand operand of type 'std::istream' (or there is no acceptable conversion)
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1053): could be 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &&,signed char *)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1060): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &&,signed char &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1067): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &&,unsigned char *)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1074): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &&,unsigned char &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1098): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &,signed char *)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1105): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &,signed char &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1112): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &,unsigned char *)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1119): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &,unsigned char &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1129): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><char,std::char_traits<char>,double[5][5]>(std::basic_istream<_Elem,_Traits> &&,_Ty (&))'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>,
    1> _Ty=double [5][5]
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(179): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(std::basic_istream<_Elem,_Traits> &(__cdecl *)(std::basic_istream<_Elem,_Traits> &))'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(185): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(std::basic_ios<_Elem,_Traits> &(__cdecl *)(std::basic_ios<_Elem,_Traits> &))'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(192): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(std::ios_base &(__cdecl *)(std::ios_base &))'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(199): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(std::_Bool &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(218): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(short &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(253): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(unsigned short &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(272): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(int &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(298): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(unsigned int &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(316): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(long &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(334): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(unsigned long &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(354): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(__int64 &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(373): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(unsigned __int64 &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(392): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(float &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(411): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(double &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(429): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(long double &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(447): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(void *&)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(466): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(std::basic_streambuf<_Elem,_Traits> *)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> while trying to match the argument list '(std::istream, double [5][5])'
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(160): error C2065: 'make' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(162): error C2065: 'make' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(169): error C2065: 'make' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(171): error C2065: 'model' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(176): error C2065: 'make' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(178): error C2065: 'color' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(185): error C2065: 'make' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(187): error C2065: 'year' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(193): error C2065: 'make' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(195): error C2065: 'mileage' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(200): error C2601: 'Car::car_details' : local function definitions are illegal
    1> c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(149): this line contains a '{' which has not yet been matched
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(213): error C2065: 'num' : undeclared identifier
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
     
  5. Jan 31, 2010 at 9:02 PM
    #5
    NetMonkey

    NetMonkey Well-Known Member

    Joined:
    Aug 14, 2008
    Member:
    #8536
    Messages:
    1,725
    Gender:
    Male
    Geogetown, TX
    Vehicle:
    2010, 4x4, DC, off-road, shortbed, automatic
    Toytec Ultimate Lift @ 3", Mickey Thompson MTZ's 285/75/16, Moto Metal 955b, rear 2" ALL, Marlin Crawler sliders
    you are missing a semi colon at line 123/124


    const int NUM_COLS = 5,
    NUM_ROWS = 5

    :)
     
  6. Jan 31, 2010 at 9:04 PM
    #6
    tarheelfan_08

    tarheelfan_08 [OP] Carolina Alliance

    Joined:
    Jan 4, 2008
    Member:
    #4098
    Messages:
    2,946
    Gender:
    Male
    First Name:
    Justin
    North Carolina
    Vehicle:
    2010 White 4x4 Double Cab Tacoma Short Bed
    Chrome Grill, Chrome accessories(door handles and mirror covers), LEER Super White Cover, Mirrors with Turn Signals, Window Vent Visors, Step Rails, WeatherTech Digital Floor Mats, Mini Maglight Holder, Chrome Bull Bar

    fixed, now these errors...dang I feel dumb! lol


    1>------ Build started: Project: Test, Configuration: Debug Win32 ------
    1> test.cpp
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(125): error C2440: 'initializing' : cannot convert from 'const char [5]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(125): error C2440: 'initializing' : cannot convert from 'const char [8]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(125): error C2440: 'initializing' : cannot convert from 'const char [5]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(126): error C2440: 'initializing' : cannot convert from 'const char [7]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(126): error C2440: 'initializing' : cannot convert from 'const char [7]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(126): error C2440: 'initializing' : cannot convert from 'const char [6]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(127): error C2440: 'initializing' : cannot convert from 'const char [7]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(127): error C2440: 'initializing' : cannot convert from 'const char [7]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(127): error C2440: 'initializing' : cannot convert from 'const char [5]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(128): error C2440: 'initializing' : cannot convert from 'const char [6]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(128): error C2440: 'initializing' : cannot convert from 'const char [7]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(128): error C2440: 'initializing' : cannot convert from 'const char [5]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(129): error C2440: 'initializing' : cannot convert from 'const char [5]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(129): error C2440: 'initializing' : cannot convert from 'const char [9]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(129): error C2440: 'initializing' : cannot convert from 'const char [5]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(153): error C2678: binary '>>' : no operator found which takes a left-hand operand of type 'std::istream' (or there is no acceptable conversion)
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1053): could be 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &&,signed char *)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1060): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &&,signed char &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1067): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &&,unsigned char *)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1074): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &&,unsigned char &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1098): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &,signed char *)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1105): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &,signed char &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1112): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &,unsigned char *)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1119): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &,unsigned char &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1129): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><char,std::char_traits<char>,double[5][5]>(std::basic_istream<_Elem,_Traits> &&,_Ty (&))'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>,
    1> _Ty=double [5][5]
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(179): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(std::basic_istream<_Elem,_Traits> &(__cdecl *)(std::basic_istream<_Elem,_Traits> &))'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(185): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(std::basic_ios<_Elem,_Traits> &(__cdecl *)(std::basic_ios<_Elem,_Traits> &))'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(192): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(std::ios_base &(__cdecl *)(std::ios_base &))'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(199): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(std::_Bool &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(218): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(short &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(253): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(unsigned short &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(272): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(int &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(298): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(unsigned int &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(316): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(long &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(334): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(unsigned long &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(354): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(__int64 &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(373): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(unsigned __int64 &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(392): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(float &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(411): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(double &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(429): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(long double &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(447): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(void *&)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(466): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(std::basic_streambuf<_Elem,_Traits> *)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> while trying to match the argument list '(std::istream, double [5][5])'
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(160): error C2065: 'make' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(162): error C2065: 'make' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(169): error C2065: 'make' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(171): error C2065: 'model' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(176): error C2065: 'make' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(178): error C2065: 'color' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(185): error C2065: 'make' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(187): error C2065: 'year' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(193): error C2065: 'make' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(195): error C2065: 'mileage' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(200): error C2601: 'Car::car_details' : local function definitions are illegal
    1> c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(149): this line contains a '{' which has not yet been matched
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(213): error C2065: 'num' : undeclared identifier
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
     
  7. Jan 31, 2010 at 9:05 PM
    #7
    AvsFanTRD

    AvsFanTRD Oh gravity, thou art a heartless bitch!

    Joined:
    Aug 6, 2009
    Member:
    #20761
    Messages:
    3,259
    Gender:
    Male
    First Name:
    Brandon
    Wyoming
    Vehicle:
    2008 TRD Off Road Black
    rear suspension TSB, sockmonkey bed decals, weathertech floor liners, TRD seat covers, tailgate pop n lock, rear diff breather relocation, center console lock, Viper Alarm, extra D-rings in bed, 5100's on all 4 corners
    This is why I changed my major when I was in college to not be computer science.
     
  8. Jan 31, 2010 at 9:06 PM
    #8
    tcBob

    tcBob Gringo Bandito Moderator

    Joined:
    Sep 6, 2006
    Member:
    #1
    Messages:
    11,256
    Gender:
    Male
    First Name:
    Bob
    SoCal
    Vehicle:
    07 PreRunner SR5 V6 Black
    just to add to eamonkey's generous assistance, I wanna give you some debugging advice. always check the line the 1st compiler error is occurring at (line 125 in this case) and work up line by line, until you find the error you made. once that's fixed, you'll notice most of the other hundred errors suddenly disappear.
     
  9. Jan 31, 2010 at 9:13 PM
    #9
    tarheelfan_08

    tarheelfan_08 [OP] Carolina Alliance

    Joined:
    Jan 4, 2008
    Member:
    #4098
    Messages:
    2,946
    Gender:
    Male
    First Name:
    Justin
    North Carolina
    Vehicle:
    2010 White 4x4 Double Cab Tacoma Short Bed
    Chrome Grill, Chrome accessories(door handles and mirror covers), LEER Super White Cover, Mirrors with Turn Signals, Window Vent Visors, Step Rails, WeatherTech Digital Floor Mats, Mini Maglight Holder, Chrome Bull Bar
    Thanks,


    Here is new code and errors. I got no clue how to fix the first ones! I am about to die if I do not get this project done...its due first thing in the morning and I have spent 2 days on it!


    Code:
    #include <iostream>
    #include <fstream>
    #include <iomanip>
    #include <functional>
    #include <algorithm>
    #include <string>
    #include <cstdlib>
    
    using namespace std;
    ofstream out;
    
    class Car {
    private:
        string make;  //make
        string model; // model
        string color;  // color
        int bay;    //bay number
        int    year;  // year
        int mileage;  // miles on car
    
    
    
    public:
        Car(); //constructor
        Car(string, string, string, int ,int, int);
    
        void setMake(string);
        void setModel(string);
        void setColor(string);
        void setYear(int);
        void setMileage(int);
    
        
    
        string getMake();
        string getModel();
        string getColor();
        int getYear();
        int getMileage();
    
    
        void valid_mileage(int);
        void car_details();
    
    };
    
    
    //----------------------------------------------------------------
    //class definition..
    Car::Car() {
        make = " ";
        model = " ";
        color = " ";
        year = 0;
        mileage = 0;
    
    }
    
    Car::Car(string make, string model, string color, int year, int mileage, int service) {
        Car::make =  make;
        Car::model = model;
        Car::color = color;
        Car::year = year;
        valid_mileage(mileage);
    
    }
    
    void Car::setMake(string make) {
        Car::make = make;
    }
    
    void Car::setModel(string model) {
        Car::model = model;
    }
    
    void Car::setColor(string color) {
        Car::color = color;
    }
    
    void Car::setYear(int year) {
        Car::year = year;
    }
    
    void Car::setMileage(int mileage) {
        valid_mileage(mileage);
    }
    
    
    string Car::getMake() {
        return make;
    }
    string Car::getModel() {
        return model;
    }
    string Car::getColor() {
        return color;
    }
    int Car::getYear() {
        return year;
    }
    int Car::getMileage() {
        return mileage;
    }
    
    void Car::valid_mileage(int mileage) {
        if (mileage>=0)
            Car::mileage=mileage;
        else {
            Car::mileage=0;
            cout << "Warning! Not a valid mileage!\n";
        }
    }
    
    
    
    int main() {
    
    
    
    
        int i;
        const int     NUM_COLS = 5,
                        NUM_ROWS = 5;
    
        double bay[NUM_ROWS][NUM_COLS] =             {{"Ford", "Mustang", "Blue", 2010, 7500},
                                                    {"Toyota", "Tacoma", "White", 1996, 107000},
                                                    {"Nissan", "Altima", "Blue", 2007, 4210},
                                                    {"Honda", "Accord", "Blue", 1999, 97500},
                                                    {"Jeep", "Wrangler", "Blue", 2001, 85000}};
        int menu;
    
                
        
        cout << "Car Menu\n\n";            //Menu 
        cout << "1. Choose Service Bay (1-5)\n";
        cout << "2. Change Make of car in the Current Service Bay\n";
        cout << "3. Change Model of car in th current Service Bay\n";
        cout << "4. Change Color of car in the Current Service Bay\n";
        cout << "5. Change Year of car in the Current Service Bay\n";
        cout << "6. Change Mileageof car in the Current Service Bay\n";
        cout << "7. Display Car in Current Service Bay\n";
        cout << "8. Save\n";
        cout << "9. Exit\n\n\n";
        cout << "Please choose one of the above options\n";
        cin >> menu;
        while(menu!=9);//keep on keepin on till they pick exit!
    
                    switch ( menu )
                {
                    case 1: 
                        
                                cout << " Pick a service Bay (1-5) to edit\n";
                                cin >> bay;
                        
    
                            break;
                    case 2: 
                            
                        
                            cout << " The Make of car in the current service bay is:" << make << endl;
                            cout << " Please Enter the change to the make of the car:";
                            cin >> make;
                        
    
                            break;
                    case 3: 
                            
                        
                            cout << " The Model of car in the current service bay is:" << make << endl;
                            cout << " Please Enter the change to the model of the car:";
                            cin >> model;
                        
                            break;
                    case 4:
                        
                            cout << " The Color of car in the current service bay is:" << make << endl;
                            cout << " Please Enter the change to the color of the car:";
                            cin >> color;
                        
                            
                            break;
    
                    case 5: 
                        
                            cout << " The Year of car in the current service bay is:" << make << endl;
                            cout << " Please Enter the change to the year of the car:";
                            cin >> year;
                        
                            
                            break;
                    case 6: 
                        
                            cout << " The Mileage of car in the current service bay is:" << make << endl;
                            cout << " Please Enter the change to the mileage of the car:";
                            cin >> mileage;
                        
                            
                            break;
                    case 7: 
                            void Car::car_details() {
                            cout << "The current car is a " << year << ' ' << color << ' '
                            << make << " with " << mileage << " miles.\n";
                            }
                            break;
                    case 8:
                          out.open("car.txt"); // opens the file
                           if( !out ) { // file couldn't be opened
                              cerr << "Error: file could not be opened" << endl;
                              exit(1);
                           }
    
                          for (i=0; i<5; ++i)
                              out << num[i] << endl;
                           out.close();
    
                            break;
    
                    default:
                        cout << " Please restart the program, you have messed up!!!!"; 
                            break;
    
                }
    
                
    
        
        return 0;
    }
    
    Errors


    1>------ Build started: Project: Test, Configuration: Debug Win32 ------
    1> test.cpp
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(125): error C2440: 'initializing' : cannot convert from 'const char [5]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(125): error C2440: 'initializing' : cannot convert from 'const char [8]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(125): error C2440: 'initializing' : cannot convert from 'const char [5]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(126): error C2440: 'initializing' : cannot convert from 'const char [7]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(126): error C2440: 'initializing' : cannot convert from 'const char [7]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(126): error C2440: 'initializing' : cannot convert from 'const char [6]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(127): error C2440: 'initializing' : cannot convert from 'const char [7]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(127): error C2440: 'initializing' : cannot convert from 'const char [7]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(127): error C2440: 'initializing' : cannot convert from 'const char [5]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(128): error C2440: 'initializing' : cannot convert from 'const char [6]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(128): error C2440: 'initializing' : cannot convert from 'const char [7]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(128): error C2440: 'initializing' : cannot convert from 'const char [5]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(129): error C2440: 'initializing' : cannot convert from 'const char [5]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(129): error C2440: 'initializing' : cannot convert from 'const char [9]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(129): error C2440: 'initializing' : cannot convert from 'const char [5]' to 'double'
    1> There is no context in which this conversion is possible
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(153): error C2678: binary '>>' : no operator found which takes a left-hand operand of type 'std::istream' (or there is no acceptable conversion)
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1053): could be 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &&,signed char *)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1060): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &&,signed char &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1067): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &&,unsigned char *)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1074): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &&,unsigned char &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1098): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &,signed char *)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1105): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &,signed char &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1112): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &,unsigned char *)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1119): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &,unsigned char &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(1129): or 'std::basic_istream<_Elem,_Traits> &std::eek:perator >><char,std::char_traits<char>,double[5][5]>(std::basic_istream<_Elem,_Traits> &&,_Ty (&))'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>,
    1> _Ty=double [5][5]
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(179): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(std::basic_istream<_Elem,_Traits> &(__cdecl *)(std::basic_istream<_Elem,_Traits> &))'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(185): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(std::basic_ios<_Elem,_Traits> &(__cdecl *)(std::basic_ios<_Elem,_Traits> &))'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(192): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(std::ios_base &(__cdecl *)(std::ios_base &))'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(199): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(std::_Bool &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(218): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(short &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(253): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(unsigned short &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(272): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(int &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(298): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(unsigned int &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(316): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(long &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(334): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(unsigned long &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(354): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(__int64 &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(373): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(unsigned __int64 &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(392): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(float &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(411): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(double &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(429): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(long double &)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(447): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(void *&)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\istream(466): or 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::eek:perator >>(std::basic_streambuf<_Elem,_Traits> *)'
    1> with
    1> [
    1> _Elem=char,
    1> _Traits=std::char_traits<char>
    1> ]
    1> while trying to match the argument list '(std::istream, double [5][5])'
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(160): error C2065: 'make' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(162): error C2065: 'make' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(169): error C2065: 'make' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(171): error C2065: 'model' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(176): error C2065: 'make' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(178): error C2065: 'color' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(185): error C2065: 'make' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(187): error C2065: 'year' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(193): error C2065: 'make' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(195): error C2065: 'mileage' : undeclared identifier
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(200): error C2601: 'Car::car_details' : local function definitions are illegal
    1> c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(149): this line contains a '{' which has not yet been matched
    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(213): error C2065: 'num' : undeclared identifier
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
     
  10. Jan 31, 2010 at 9:13 PM
    #10
    NetMonkey

    NetMonkey Well-Known Member

    Joined:
    Aug 14, 2008
    Member:
    #8536
    Messages:
    1,725
    Gender:
    Male
    Geogetown, TX
    Vehicle:
    2010, 4x4, DC, off-road, shortbed, automatic
    Toytec Ultimate Lift @ 3", Mickey Thompson MTZ's 285/75/16, Moto Metal 955b, rear 2" ALL, Marlin Crawler sliders
    you have mixed types in your array.

    you have declared it as an array of doubles, but you are entering strings AND doubles for the values:


    Code:
        double bay[NUM_ROWS][NUM_COLS] =             {{"Ford", "Mustang", "Blue", 2010, 7500},
                                                    {"Toyota", "Tacoma", "White", 1996, 107000},
                                                    {"Nissan", "Altima", "Blue", 2007, 4210},
                                                    {"Honda", "Accord", "Blue", 1999, 97500},
                                                    {"Jeep", "Wrangler", "Blue", 2001, 85000}};
    you may want to consider creating a new class or a struct to hold the details of the car. so then you could declare a single dementional array of that new struct.

    C# code is fresh on my brain, so..

    Code:
        public struct CarDefinition
        {
            public double m_year, m_milage;
            public string m_make, m_model, m_color;
        }
     
        CarDefinition[] myCarDefs = new CarDefinition[5];
     
        myCarDefs[1].m_year = 1990;
    etc...
     
  11. Jan 31, 2010 at 9:20 PM
    #11
    tarheelfan_08

    tarheelfan_08 [OP] Carolina Alliance

    Joined:
    Jan 4, 2008
    Member:
    #4098
    Messages:
    2,946
    Gender:
    Male
    First Name:
    Justin
    North Carolina
    Vehicle:
    2010 White 4x4 Double Cab Tacoma Short Bed
    Chrome Grill, Chrome accessories(door handles and mirror covers), LEER Super White Cover, Mirrors with Turn Signals, Window Vent Visors, Step Rails, WeatherTech Digital Floor Mats, Mini Maglight Holder, Chrome Bull Bar
    This is c++
     
  12. Jan 31, 2010 at 9:21 PM
    #12
    NetMonkey

    NetMonkey Well-Known Member

    Joined:
    Aug 14, 2008
    Member:
    #8536
    Messages:
    1,725
    Gender:
    Male
    Geogetown, TX
    Vehicle:
    2010, 4x4, DC, off-road, shortbed, automatic
    Toytec Ultimate Lift @ 3", Mickey Thompson MTZ's 285/75/16, Moto Metal 955b, rear 2" ALL, Marlin Crawler sliders
    also, when you are debugging your code, dont get over whelmed by the number of errors. a single missing semi colon can cause 1000's of errors in the code below it. instead, look at the first error in that list. for example:

    1>c:\users\justin puckett\documents\my stuff\school work\second semester\spring 2009\c++\week 1 menu driven, file pulling\test\test\test.cpp(125): error C2440: 'initializing' : cannot convert from 'const char [5]' to 'double'
    1> There is no context in which this conversion is possible

    it tells you the line number and the specific error. its easy to see what the problem is.
     
  13. Jan 31, 2010 at 9:24 PM
    #13
    tarheelfan_08

    tarheelfan_08 [OP] Carolina Alliance

    Joined:
    Jan 4, 2008
    Member:
    #4098
    Messages:
    2,946
    Gender:
    Male
    First Name:
    Justin
    North Carolina
    Vehicle:
    2010 White 4x4 Double Cab Tacoma Short Bed
    Chrome Grill, Chrome accessories(door handles and mirror covers), LEER Super White Cover, Mirrors with Turn Signals, Window Vent Visors, Step Rails, WeatherTech Digital Floor Mats, Mini Maglight Holder, Chrome Bull Bar

    Yea, but the fixing it is another problem. I am still trying to understand what you said in the previous post and how to fix my code with it!
     
  14. Jan 31, 2010 at 9:24 PM
    #14
    NetMonkey

    NetMonkey Well-Known Member

    Joined:
    Aug 14, 2008
    Member:
    #8536
    Messages:
    1,725
    Gender:
    Male
    Geogetown, TX
    Vehicle:
    2010, 4x4, DC, off-road, shortbed, automatic
    Toytec Ultimate Lift @ 3", Mickey Thompson MTZ's 285/75/16, Moto Metal 955b, rear 2" ALL, Marlin Crawler sliders
    i know, but you get the point. the language is irrelavant, its the data structure that you need to learn.

    look up structures/classes for C++ and you can make one to hold all your car details. then make an array of that type.
     
  15. Jan 31, 2010 at 9:29 PM
    #15
    NetMonkey

    NetMonkey Well-Known Member

    Joined:
    Aug 14, 2008
    Member:
    #8536
    Messages:
    1,725
    Gender:
    Male
    Geogetown, TX
    Vehicle:
    2010, 4x4, DC, off-road, shortbed, automatic
    Toytec Ultimate Lift @ 3", Mickey Thompson MTZ's 285/75/16, Moto Metal 955b, rear 2" ALL, Marlin Crawler sliders
  16. Jan 31, 2010 at 9:33 PM
    #16
    NetMonkey

    NetMonkey Well-Known Member

    Joined:
    Aug 14, 2008
    Member:
    #8536
    Messages:
    1,725
    Gender:
    Male
    Geogetown, TX
    Vehicle:
    2010, 4x4, DC, off-road, shortbed, automatic
    Toytec Ultimate Lift @ 3", Mickey Thompson MTZ's 285/75/16, Moto Metal 955b, rear 2" ALL, Marlin Crawler sliders
    this site talks about arrays of structs in c++

    http://frank.mtsu.edu/~csci217/manual/lab5/lab2.htm

    Code:
     
    //set up global struct type 
    struct Video 
    { 
    char movieTitle[MAX_LETTERS]; //name of movie 
    unsigned int numberCopies; //number of copies owned 
    char videoType [MAX_LETTERS]; //type of video 
    };
     
    const unsigned int MAX_VIDEOS = 100; 
    Video allVideos[MAX_VIDEOS];
    
     
  17. Jan 31, 2010 at 9:38 PM
    #17
    tarheelfan_08

    tarheelfan_08 [OP] Carolina Alliance

    Joined:
    Jan 4, 2008
    Member:
    #4098
    Messages:
    2,946
    Gender:
    Male
    First Name:
    Justin
    North Carolina
    Vehicle:
    2010 White 4x4 Double Cab Tacoma Short Bed
    Chrome Grill, Chrome accessories(door handles and mirror covers), LEER Super White Cover, Mirrors with Turn Signals, Window Vent Visors, Step Rails, WeatherTech Digital Floor Mats, Mini Maglight Holder, Chrome Bull Bar
    Great links, hopefull they can help me figure this out! I need to go to bed soon so I am not tired...but I have to have this done!
     
  18. Jan 31, 2010 at 9:39 PM
    #18
    NetMonkey

    NetMonkey Well-Known Member

    Joined:
    Aug 14, 2008
    Member:
    #8536
    Messages:
    1,725
    Gender:
    Male
    Geogetown, TX
    Vehicle:
    2010, 4x4, DC, off-road, shortbed, automatic
    Toytec Ultimate Lift @ 3", Mickey Thompson MTZ's 285/75/16, Moto Metal 955b, rear 2" ALL, Marlin Crawler sliders
    so... in C++

    Code:
     
        struct CarDefinition
        {
            double m_year, m_milage;
            string m_make, m_model, m_color;
        };
     
        CarDefinition myCarDefs[5];
     
        myCarDefs[0].m_year   = 2010;
        myCarDefs[0].m_milage = 7500;
        myCarDefs[0].m_make   = "Ford";
        myCarDefs[0].m_model  = "Mustang";
        myCarDefs[0].m_color  = "Blue";
    
    and you can enter the rest of the cars
     
  19. Jan 31, 2010 at 9:45 PM
    #19
    NetMonkey

    NetMonkey Well-Known Member

    Joined:
    Aug 14, 2008
    Member:
    #8536
    Messages:
    1,725
    Gender:
    Male
    Geogetown, TX
    Vehicle:
    2010, 4x4, DC, off-road, shortbed, automatic
    Toytec Ultimate Lift @ 3", Mickey Thompson MTZ's 285/75/16, Moto Metal 955b, rear 2" ALL, Marlin Crawler sliders
    if you declare an array of doubles, you can ONLY set double values into that array. in this line, you are trying to set doubles AND strings. thats bad.

    Code:
     double bay[NUM_ROWS][NUM_COLS] =  {{"Ford", "Mustang", "Blue", 2010, 7500},
     
  20. Jan 31, 2010 at 9:59 PM
    #20
    Kappes03

    Kappes03 Legend of the UG

    Joined:
    Jul 2, 2009
    Member:
    #19187
    Messages:
    5,559
    Gender:
    Male
    First Name:
    Mike
    (Colorado)JBLM, WA
    Vehicle:
    2009 Access cab Off-Road
    Check The Build Page
    x2 though I changed mine mostly cuz I don't like math baha
     
To Top