1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
|
#include <iostream>
#include<cstdlib>
using namespace std;
/** Showing the introduction screen and the user maual... */
void splash(void) {
cout << " ********************************************************\n";
cout << " * *\n";
cout << " * Velocity And Gear Programme .. * \n";
cout << " * By:*****\n";
cout << " * *\n";
cout << " ********************************************************\n\n";
cout<<endl ;
system ("PAUSE");
system ("cls");
cout << "****************************************************************\n";
cout << "* USER MANUAL *\n";
cout << "* FIRST :The programme will ask you to input the accelration * \n";
cout << "* SECOND : The programme will ask you to input the time *\n";
cout << "* THIRED : The programe will calcluate the velocity *\n";
cout << "****************************************************************\n\n";
system ("PAUSE");
system ("cls");
}
/** Showing the introduction screen and the user maual... */
void input(double &accel,double &time)
{
cout<<"What was your Accelaration in (km/hour) : ";
cin>>accel;
cout<<"\nWhat was your riding time ";
cin>>time;
}
double Velocity(double accel,double time)// to calcluate the Volcity
{
double Velocity = accel*time;
return Velocity;
}
int main ()
{
double accel;
double time;
char choice;
splash();
do
{
input(accel,time);
if (Velocity(accel,time)>=0 && Velocity(accel,time)<4)
{
cout<<"\nyour Velocity was "<<Velocity<<endl;
cout<<" YOUR GEAR IS : 1";
}
else if (Velocity(accel,time) >=4 && Velocity(accel,time)<5)
{
cout<<"\nyour Velocity was "<<Velocity(accel,time)<<endl;
cout<<" YOUR GEAR IS : 2";
}
else if (Velocity(accel,time) >=5 && Velocity(accel,time)<7)
{
cout<<"\nyour Velocity was "<<Velocity(accel,time)<<endl;
cout<<" YOUR GEAR IS : 3";
}
else if (Velocity(accel,time) >=7 && Velocity(accel,time)<10)
{
cout<<"\nyour Velocity was "<<Velocity(accel,time)<<endl;
cout<<" YOUR GEAR IS : 4";
}
else if (Velocity(accel,time) >=10 && Velocity(accel,time)<12)
{
cout<<"\nyour Velocity was "<<Velocity(accel,time)<<endl;
cout<<" YOUR GEAR IS : 5";
}
else if (Velocity(accel,time) >=12 && Velocity(accel,time)<15)
{
cout<<"\nyour Velocity was "<<Velocity(accel,time)<<endl;
cout<<" YOUR GEAR IS : 6";
}
else if (Velocity(accel,time) >=15 && Velocity(accel,time)<17)
{
cout<<"\nyour volcity was "<<Velocity(accel,time)<<endl;
cout<<" YOUR GEAR IS : 7";
}
else if (Velocity(accel,time) >=17 && Velocity(accel,time)<21)
{
cout<<"\nyour Velocity was "<<Velocity(accel,time)<<endl;
cout<<" YOUR GEAR IS : 8";
}
else if (Velocity(accel,time) >=21 && Velocity(accel,time)<24)
{
cout<<"\nyour Velocity was "<<Velocity(accel,time)<<endl;
cout<<" YOUR GEAR IS : 9";
}
else if (Velocity(accel,time) >=24 && Velocity(accel,time)<28)
{
cout<<"\nyour Velocity was "<<Velocity(accel,time)<<endl;
cout<<" YOUR GEAR IS : 10";
}
else if (Velocity(accel,time) >=28 && Velocity(accel,time)<35)
{
cout<<"\nyour Velocity was "<<Velocity(accel,time)<<endl;
cout<<" YOUR GEAR IS : 11";
}
else if (Velocity(accel,time) >=35 && Velocity(accel,time)<40)
{
cout<<"\nyour Velocity was "<<Velocity(accel,time)<<endl;
cout<<" YOUR GEAR IS : 12";
}
else if (Velocity(accel,time) >=40 && Velocity(accel,time)<48)
{
cout<<"\nyour Velocity was "<<Velocity(accel,time)<<endl;
cout<<" YOUR GEAR IS : 13";
}
else if (Velocity(accel,time) >=48 && Velocity(accel,time)<55)
{
cout<<"\nyour Velocity was "<<Velocity(accel,time)<<endl;
cout<<"YOUR GEAR IS : 14";
}
else if (Velocity(accel,time) >=55 && Velocity(accel,time)<100)
{
cout<<"\nYour Velocity was "<<Velocity(accel,time)<<endl;
cout<<"YOUR GEAR IS : 15";
}
else if (Velocity(accel,time) >100 )
{
cout<<" The Maximmum Volcity that the programme can calcluate is 100 km/hr... SORRY!";
}
else if (Velocity(accel,time) <0 )
{
cout<<" ERROR!!";
}
cout<<"\n\nDo you wish to continue? (Y/N)";
cin>>choice;
cout<<"\n\n\n----------------------------\n\n\n";
system("cls");
}
while(choice == 'Y'|| choice == 'y');
return 0;
}
|