WHT!!!!
i dont know whats wrong but i tried to to Merge both codes
the if - statement dont show ...
#include <iostream>
#include<cstdlib>
#include<stdio.h>
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... */
double Velocity(double accel,double ntime)// to calcluate the Volcity
{
double Velocity = accel*ntime;
return Velocity;
}
int main ()
{
double accel;
double ntime;
char choice;
char time[8];
double h=0, m=0, s=0;
splash();
do
{
cout<<"What was your Accelaration in (km/hour) : ";
cin>>accel;
cout<<"\nWhat was your riding time in hr.min : ";
gets(time);
h=(time[1]+(10*(time[0])))-528;
m=(time[4]+(10*(time[3])))-528;
s=(time[7]+(10*(time[6])))-528;
//------>start if for the time..
if(
h>=0 && h <=60&&
m>=0 && m <=60&&
s>=0 && s <=60
)
{
cout<<"YOUR time is: "<<time[0]<<time[1]<<":"<<time[3]<<time[4]<<":"<<time[6]<<time[7]<<endl; //OR:
double ntime=h+m/60+s/3600;
cout<<"/n your time is"<<ntime;
//-------->the if for velocity..
Velocity(accel,ntime);
if (Velocity(accel,ntime)>=0 && Velocity(accel,ntime)<4)
{
cout<<"\nyour Velocity was "<<Velocity<<endl;
cout<<" YOUR GEAR IS : 1";
}
else if (Velocity(accel,ntime) >=4 && Velocity(accel,ntime)<5)
{
cout<<"\nyour Velocity was "<<Velocity(accel,ntime)<<endl;
cout<<" YOUR GEAR IS : 2";
}
else if (Velocity(accel,ntime) >=5 && Velocity(accel,ntime)<7)
{
cout<<"\nyour Velocity was "<<Velocity(accel,ntime)<<endl;
cout<<" YOUR GEAR IS : 3";
}
else if (Velocity(accel,ntime) >=7 && Velocity(accel,ntime)<10)
{
cout<<"\nyour Velocity was "<<Velocity(accel,ntime)<<endl;
cout<<" YOUR GEAR IS : 4";
}
else if (Velocity(accel,ntime) >=10 && Velocity(accel,ntime)<12)
{
cout<<"\nyour Velocity was "<<Velocity(accel,ntime)<<endl;
cout<<" YOUR GEAR IS : 5";
}
else if (Velocity(accel,ntime) >=12 && Velocity(accel,ntime)<15)
{
cout<<"\nyour Velocity was "<<Velocity(accel,ntime)<<endl;
cout<<" YOUR GEAR IS : 6";
}
else if (Velocity(accel,ntime) >=15 && Velocity(accel,ntime)<17)
{
cout<<"\nyour volcity was "<<Velocity(accel,ntime)<<endl;
cout<<" YOUR GEAR IS : 7";
}
else if (Velocity(accel,ntime) >=17 && Velocity(accel,ntime)<21)
{
cout<<"\nyour Velocity was "<<Velocity(accel,ntime)<<endl;
cout<<" YOUR GEAR IS : 8";
}
else if (Velocity(accel,ntime) >=21 && Velocity(accel,ntime)<24)
{
cout<<"\nyour Velocity was "<<Velocity(accel,ntime)<<endl;
cout<<" YOUR GEAR IS : 9";
}
else if (Velocity(accel,ntime) >=24 && Velocity(accel,ntime)<28)
{
cout<<"\nyour Velocity was "<<Velocity(accel,ntime)<<endl;
cout<<" YOUR GEAR IS : 10";
}
else if (Velocity(accel,ntime) >=28 && Velocity(accel,ntime)<35)
{
cout<<"\nyour Velocity was "<<Velocity(accel,ntime)<<endl;
cout<<" YOUR GEAR IS : 11";
}
else if (Velocity(accel,ntime) >=35 && Velocity(accel,ntime)<40)
{
cout<<"\nyour Velocity was "<<Velocity(accel,ntime)<<endl;
cout<<" YOUR GEAR IS : 12";
}
else if (Velocity(accel,ntime) >=40 && Velocity(accel,ntime)<48)
{
cout<<"\nyour Velocity was "<<Velocity(accel,ntime)<<endl;
cout<<" YOUR GEAR IS : 13";
}
else if (Velocity(accel,ntime) >=48 && Velocity(accel,ntime)<55)
{
cout<<"\nyour Velocity was "<<Velocity(accel,ntime)<<endl;
cout<<"YOUR GEAR IS : 14";
}
else if (Velocity(accel,ntime) >=55 && Velocity(accel,ntime)<100)
{
cout<<"\nYour Velocity was "<<Velocity(accel,ntime)<<endl;
cout<<"YOUR GEAR IS : 15";
}
else if (Velocity(accel,ntime) >100 )
{
cout<<" The Maximmum Volcity that the programme can calcluate is 100 km/hr... SORRY!";
}
else if (Velocity(accel,ntime) <0 )
{
cout<<" ERROR!!";
}
}
//------->end of if velocity
else// else for if time
{
cout<< "Your time is Invalid";
}
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;
}