lundi 27 avril 2015

Need assistance with code so that it comes back and displays the "Menu"

I am making a small project, using variables and classes:

http://ift.tt/1Ftdcn0

When I change variables using the default constructor their values don't change.

water::water()
{
    current_state = w_state[1];
    ph = 7;
    w_temp = 20;
    w_density = 1.00;
    dissol = 1;
    current_impurity = w_imp[0];
    int color = 0x02;
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),color),
    cout<<"What would you like to do?"<<endl;
    color++;
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),color),
    cout<<"0. Get current stats of water"<<endl;
    cout<<"1. Raise water temperature by certain degrees"<<endl;
    cout<<"2. Decrease water temperature by certain degrees"<<endl;
    cout<<"3. Raise ph level"<<endl;
    cout<<"4. Decrease ph level"<<endl;
    cout<<"5. Add impurity to water"<<endl;
    cout<<"6. Store current stats of water to filename of your choice"<<endl;
    cout<<"7. Retrieve Current stats of water from filename of your choice"<<endl;
    cout<<"8. Graphically show the water cycle"<<endl;
    cin >> do_what;
    cout<<do_what;
    switch(do_what)
    {
        case 0 :check_status();
                break;
        case 1 :heat_water();
                break;
        case 2 :cool_water();
                break;
        case 3 :add_ph();
                break;
        case 4 :reduce_ph();
                break;
        case 5:add_impu();
                break;
        case 6 :push_file();
                break;
        case 7 :pull_file();
                break;
        case 8 :graph_rep_water();
                break;
        default:cout<<"Enter proper value!"<<endl;
                //system("cls");
                //water();
                break;      
    }
}

This is the default constructor. It is not able to change variable values which are declared in its main class which is class water

Aucun commentaire:

Enregistrer un commentaire