BOTASHQIPTAREFORUM

Would you like to react to this message? Create an account in a few clicks or log in to continue.

    Llogarit Shpejtesin.... C++

    Anonymous
    Vizitor
    Vizitor


    Buzqeshje Llogarit Shpejtesin.... C++

    Mesazh nga Vizitor 7/10/2009, 17:04

    Kodi:
    Programi i meposhtem llogarit shpejtesine mesatare, distancen dhe kohen per sa keni vrapuar nje milje(per ata qe vrapojne)

    #include
    using namespace std;
    int main ()
    {
    float laps, time, speed, distance, aver;
    cout << fixed<< setprecision(2);
    cout <<"Enter the number of laps you run \n" ;
    cin >> laps;
    cout << "Enter the time of your run in seconds \n";
    cin >> time;
    distance=0.1456439 *laps;
    speed=distance/3600*time;
    aver=distance/60*time;
    cout <<"Your total run length for today is " <cout <<"You have been running with the speed of " <cout <<"You runned a mile in " <return 0;
    }Cito:
    #include
    #include
    using namespace std;
    int main()
    {
    int value=1, counter=1, cof=0, tea=0, oj=0, lem=0;
    float perc1, perc2, perc3, perc4 ;
    while (value!=5)
    {cout<<"\nEnter your choice. Press: \n 1 for Coffee, 2 for Tea, 3 for Orange Juice, 4 for Lemonade or press 5 to quit."<cin>>value;
    switch (value)
    {
    case 1: cof++;
    break;
    case 2: tea++;
    break;
    case 3: oj++;
    break;
    case 4: lem++;
    break;
    case 5: cout<<"You just decided to quit\n.";
    break;
    default: cout<< "Please enter a valid number 1, 2, 3, 4 or 5. Your choice will not be considered.";
    break;
    }
    counter++;
    }
    cout<perc1 =cof*100/(counter-2);
    perc2 =tea*100/(counter-2);

    perc3 =oj*100/(counter-2);
    perc4 =lem*100/(counter-2);
    counter=counter-2;
    cout<< "The total number of persons that have been surveyed is " <cout<<"The results of the survey: "<cout<cout<<"-------------------------------------------------------------------------------"<cout<cout<cout<cout<return 0;
    }

      Ora ėshtė 27/4/2024, 23:16