Mesa duket nuk jeni i regjistruar, kliko ne butonin Regjisrohu nqs dëshironi të bëheni pjesë e forumit tonë, per t'u regjistruar ju hargjoni maksimumi 1 min kohë. Me respekt Staffi.


ForumPortaliCalendarPytësoriKërkoLista AnëtarëveGrupet e AnëtarëveRegjistrohuidentifikimiChatBilardo

Share | 
 

 Llogarit Shpejtesin.... C++

Shiko temën e mëparshme Shiko temën pasuese Shko poshtë 
AutoriMesazh
NoIsY
Super moderator
Super moderator


Postimet : 454
Vendodhja : n'Kamenic
Puna / Hobi : Hacker

MesazhTitulli: Llogarit Shpejtesin.... C++   Sat Dec 05, 2009 1:21 am


Kodi:

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




Kodi:

#include <iostream>
#include <iomanip>
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 " <<distance<< "miles. \n";
cout <<"You have been running with the speed of " <<speed<< "mph. \n";
cout <<"You runned a mile in " <<aver<< "minutes. \n";
return 0;
}





Kodi:

#include <iostream>
#include <iomanip>
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."<<endl;
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<<fixed<<setprecision(2);
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 " <<counter<<endl;
cout<<"The results of the survey: "<<endl;
cout<<setw(20)<<"Beverage chosen"<<setw(20)<<"Number of votes"<<setw(21)<<"Percentage"<<endl;
cout<<"-------------------------------------------------------------------------------"<<endl;
cout<<setw(20)<<"Coffee"<<setw(20)<<cof<<setw(20)< <perc1<<"%"<<endl;
cout<<setw(20)<<"Tea"<<setw(20)<<tea<<setw(20)<<pe rc2<<"%"<<endl;
cout<<setw(20)<<"Orange Juice"<<setw(20)<<oj<<setw(20)<<perc3<<"%"<<endl;
cout<<setw(20)<<"Lemonade"<<setw(20)<<lem<<setw(20 )<<perc4<<"%"<<endl;
return 0;
}

Mbrapsht në krye Shko poshtë
Shiko profilin e anëtarit http://www.deshira-juaj.tk/
 
Llogarit Shpejtesin.... C++
Shiko temën e mëparshme Shiko temën pasuese Mbrapsht në krye 
Faqja 1 e 1
 Similar topics
-

Drejtat e ktij Forumit:Ju nuk mund ti përgjigjeni temave të këtij forumi
 :: Paneli i Kontrollit :: Gjuhe Programuese-
Kërce tek: