#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    12
    Rep Power
    0

    Delaying RUNTIME execution of the programbelow


    Code:
     Delaying program execution below
    #include <iostream>
    #include <conio.h>
    #include <Windows.h>
    using namespace std;
    
    int drying_revolution (int dryingspin_revolution);
    int rinsing_revolution (int rinsingspin_revolution);
    
    int main()
    {
    enter:
    cout<<"...CHOOSE YOUR DESIRE WASHING MODE...\n";
    cout<<"ENTER 'a' for cotton mode\n";
    cout<<"ENTER 'b' for Quick wash\n";
    
    int temperature_sensor=0; //reading from the temperature sensor console in degree celsius
    
    int rinsingspin_revolution = 0;
    int dryingspin_revolution=0; // read revolution from the motor spin console
    char washtype; //gotten from user via the buttons on the machine control
    
    char cotton = 'a';
    char quickwash= 'b';
    
    cin>>washtype;
    system("cls");
    if (washtype == cotton) //link cotton as the washtype selected by the user on the machine through console
    
    {
    
    temperature_sensor = 80; // a signal is send through the console to the heater to heat the water till the temperature sensor sense up to 80 deg celcius
    cout<<"................water heating in progress.......\n";
    
    cout <<"ready for cotton";
    cout<<"............washing in progress.......";
    }
    
    
    
    if(washtype == quickwash) // links quick wash as the washtype selected by the user on the machine through the console
    {
    temperature_sensor = 40; //a signal is send through the console to heat the heater to continue heating till the temperature sensor sense up to 40 deg celcius
    cout<<"ready for quick wash";
    
    }
    else
    {
    cout<<"invalid selection";
    system("cls");
    
    }
    
    int rinsing_revolution (int rinsingspin_revolution); // set the rinse spin at 1000 revolution
    {
    
    return 1000;
    }
    int drying_revolution (int dryingspin_revolution); //set the dry rinse at 1000revolution
    {
    return 1000;
    cout<<"drying in progress......\n";
    
    
    }
    
    system ("pause");
    }
    	
    Edit/Delete Message
    Code:
     Delaying program execution below #include <iostream> #include <conio.h> #include <Windows.h> using namespace std;  int drying_revolution (int dryingspin_revolution); int rinsing_revolution (int rinsingspin_revolution);  int main() { enter: cout<<"...CHOOSE YOUR DESIRE WASHING MODE...\n"; cout<<"ENTER 'a' for cotton mode\n"; cout<<"ENTER 'b' for Quick wash\n";  int temperature_sensor=0; //reading from the temperature sensor console in degree celsius  int rinsingspin_revolution = 0; int dryingspin_revolution=0; // read revolution from the motor spin console char washtype; //gotten from user via the buttons on the machine control  char cotton = 'a'; char quickwash= 'b';  cin>>washtype; system("cls"); if (washtype == cotton) //link cotton as the washtype selected by the user on the machine through console  {  temperature_sensor = 80; // a signal is send through the console to the heater to heat the water till the temperature sensor sense up to 80 deg celcius cout<<"................water heating in progress.......\n";  cout <<"ready for cotton"; cout<<"............washing in progress......."; }    if(washtype == quickwash) // links quick wash as the washtype selected by the user on the machine through the console { temperature_sensor = 40; //a signal is send through the console to heat the heater to continue heating till the temperature sensor sense up to 40 deg celcius cout<<"ready for quick wash";  } else { cout<<"invalid selection"; system("cls");  }  int rinsing_revolution (int rinsingspin_revolution); // set the rinse spin at 1000 revolution {  return 1000; } int drying_revolution (int dryingspin_revolution); //set the dry rinse at 1000revolution { return 1000; cout<<"drying in progress......\n";   }  system ("pause"); } 	 Edit/Delete Message

    Comments on this post

    • dwise1_aol disagrees : Wow! Two ways of posting unreadable code at the same time!
  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,396
    Rep Power
    1871
    Are you even trying?
    previous post

    You just copy/pasted your previous attempt, and still missed the point.

    Since it's Sunday and I have nothing better to do at the moment, here's a free gift to the community.
    Code:
    #include <iostream>
    #include <conio.h>
    #include <Windows.h>
    using namespace std;
    
    int drying_revolution(int dryingspin_revolution);
    int rinsing_revolution(int rinsingspin_revolution);
    
    int main()
    {
      enter:
        cout << "...CHOOSE YOUR DESIRE WASHING MODE...\n";
        cout << "ENTER 'a' for cotton mode\n";
        cout << "ENTER 'b' for Quick wash\n";
    
        int temperature_sensor = 0;     //reading from the temperature sensor console in degree celsius
    
        int rinsingspin_revolution = 0;
        int dryingspin_revolution = 0;  // read revolution from the motor spin console
        char washtype;                  //gotten from user via the buttons on the machine control
    
        char cotton = 'a';
        char quickwash = 'b';
    
        cin >> washtype;
        system("cls");
        if (washtype == cotton)         //link cotton as the washtype selected by the user on the machine through console
        {
            temperature_sensor = 80;
            // a signal is send through the console to the heater to heat 
            // the water till the temperature sensor sense up to 80 deg celcius
            cout << "................water heating in progress.......\n";
            cout << "ready for cotton";
            cout << "............washing in progress.......";
        }
        if (washtype == quickwash)      // links quick wash as the washtype selected by the user on the machine through the console
        {
            temperature_sensor = 40;
            //a signal is send through the console to heat 
            // the heater to continue heating till the temperature sensor sense up to 40 deg celcius
            cout << "ready for quick wash";
        } else {
            cout << "invalid selection";
            system("cls");
        }
    
        int rinsing_revolution(int rinsingspin_revolution); // set the rinse spin at 1000 revolution
        {
            return 1000;
        }
        int drying_revolution(int dryingspin_revolution); //set the dry rinse at 1000revolution
        {
            return 1000;
            cout << "drying in progress......\n";
        }
    
        system("pause");
    }
    Here's some pseudo code for you
    Code:
    void setTemperature ( int targetTemperature ) {
      if ( getCurrentTemperature() < targetTemperature ) {
        turnOnHeater();
        do {
          Sleep(1000); // 1 second
        } while ( getCurrentTemperature() < targetTemperature );
        turnOffHeater();
      }
    }
    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

IMN logo majestic logo threadwatch logo seochat tools logo