#include <conio.h>
#include <iostream>
#include <math.h>
using namespace std;
int main ()
{
int Or, Ds, TD, Cs, Ch, Fare= 0;
cout<<" *********************************************************************************"<<endl;
cout<<" * WELCOME TO LRT 2 STATION TICKETING SYSTEM *"<<endl;
cout<<" * *"<<endl;
cout<<" * Please read the instructions below: *"<<endl;
cout<<" * 1. You will need to enter your Current Station(Please see Step #6) *"<<endl;
cout<<" * 2. Enter your destination *"<<endl;
cout<<" * 3. The program will display your Fare for your current Trip *"<<endl;
cout<<" * 4. Enter your Cash *"<<endl;
cout<<" * 5. Check your change *"<<endl;
cout<<" * 6. Here's the lists of LRT 2 Stations *"<<endl;
cout<<" * 1 = SANTOLAN *"<<endl;
cout<<" * 2 = KATIPUNAN *"<<endl;
cout<<" * 3 = ANONAS *"<<endl;
cout<<" * 4 = CUBAO *"<<endl;
cout<<" * 5 = BETTY GO *"<<endl;
cout<<" * 6 = GILMORE *"<<endl;
cout<<" * 7 = J. RUIZ *"<<endl;
cout<<" * 8 = V. MAPA *"<<endl;
cout<<" * 9 = PUREZA *"<<endl;
cout<<" * 10 = LEGARDA *"<<endl;
cout<<" * 11 = C. M. RECTO *"<<endl;
cout<<" * *"<<endl;
cout<<" * HAVE A NICE TRIP IN LRT 2! *"<<endl;
cout<<" *********************************************************************************"<<endl;
cout<<"Enter your current station:"<<endl;
cin>>Or;
if (Or == 0) {
cout<<"Oops ! Invalid input"<<endl;
cout<<"Please enter your current station"<<endl;
cin>>Or;
}
else if (Or > 12) {
cout<<" Oops ! Invalid input "<<endl;
cout<<"Please enter your current station:"<<endl;
cin>>Or;
}
else {
Or ='VALID';
}
cout<<"Enter your destination:"<<endl;
cin>>Ds;
if (Ds == 0) {
cout<< "Oops ! invalid input"<<endl;
cout<<"Please enter your destination:"<<endl;
cin>>Ds;
}
else if (Ds > 12) {
cout<<" Oops ! Invalid input "<<endl;
cout<<"Please enter your destination:"<<endl;
cin>>Ds;
}
else {
Ds ='VALID';
}
if (Or < Ds){
TD = Ds - Or;
if (TD <= 3){
cout<<"Your Fare is 15.00 pesos"<<endl;
Fare=15;
}
else if (TD <=6){
cout<<"Your Fare is 20.00 pesos"<<endl;
Fare=20;
}
else if (TD <=10){
cout<<"Your fare is 25.00 pesos"<<endl;
Fare=25;
}
else
cout<<"Invalid "<<endl;
}
else if(Or > Ds){
TD = Or- Ds;
if (TD <= 3){
cout<<"Your Fare is 15.00 pesos"<<endl;
}
else if (TD <=6){
cout<<"Your Fare is 20.00 pesos"<<endl;
}
else if (TD <=10){
cout<<"Your fare is 25.00 pesos"<<endl;
}
else ( TD == 0); {
cout<<"Invalid "<<endl;
}
}
return 0;
getch();
}
Pa tulong po. Paano po gagawin para sa if statements ng fare lumabas? Di po kasi gumagana ang condition na naka Bold Font. Salamat po.
#include <iostream>
#include <math.h>
using namespace std;
int main ()
{
int Or, Ds, TD, Cs, Ch, Fare= 0;
cout<<" *********************************************************************************"<<endl;
cout<<" * WELCOME TO LRT 2 STATION TICKETING SYSTEM *"<<endl;
cout<<" * *"<<endl;
cout<<" * Please read the instructions below: *"<<endl;
cout<<" * 1. You will need to enter your Current Station(Please see Step #6) *"<<endl;
cout<<" * 2. Enter your destination *"<<endl;
cout<<" * 3. The program will display your Fare for your current Trip *"<<endl;
cout<<" * 4. Enter your Cash *"<<endl;
cout<<" * 5. Check your change *"<<endl;
cout<<" * 6. Here's the lists of LRT 2 Stations *"<<endl;
cout<<" * 1 = SANTOLAN *"<<endl;
cout<<" * 2 = KATIPUNAN *"<<endl;
cout<<" * 3 = ANONAS *"<<endl;
cout<<" * 4 = CUBAO *"<<endl;
cout<<" * 5 = BETTY GO *"<<endl;
cout<<" * 6 = GILMORE *"<<endl;
cout<<" * 7 = J. RUIZ *"<<endl;
cout<<" * 8 = V. MAPA *"<<endl;
cout<<" * 9 = PUREZA *"<<endl;
cout<<" * 10 = LEGARDA *"<<endl;
cout<<" * 11 = C. M. RECTO *"<<endl;
cout<<" * *"<<endl;
cout<<" * HAVE A NICE TRIP IN LRT 2! *"<<endl;
cout<<" *********************************************************************************"<<endl;
cout<<"Enter your current station:"<<endl;
cin>>Or;
if (Or == 0) {
cout<<"Oops ! Invalid input"<<endl;
cout<<"Please enter your current station"<<endl;
cin>>Or;
}
else if (Or > 12) {
cout<<" Oops ! Invalid input "<<endl;
cout<<"Please enter your current station:"<<endl;
cin>>Or;
}
else {
Or ='VALID';
}
cout<<"Enter your destination:"<<endl;
cin>>Ds;
if (Ds == 0) {
cout<< "Oops ! invalid input"<<endl;
cout<<"Please enter your destination:"<<endl;
cin>>Ds;
}
else if (Ds > 12) {
cout<<" Oops ! Invalid input "<<endl;
cout<<"Please enter your destination:"<<endl;
cin>>Ds;
}
else {
Ds ='VALID';
}
if (Or < Ds){
TD = Ds - Or;
if (TD <= 3){
cout<<"Your Fare is 15.00 pesos"<<endl;
Fare=15;
}
else if (TD <=6){
cout<<"Your Fare is 20.00 pesos"<<endl;
Fare=20;
}
else if (TD <=10){
cout<<"Your fare is 25.00 pesos"<<endl;
Fare=25;
}
else
cout<<"Invalid "<<endl;
}
else if(Or > Ds){
TD = Or- Ds;
if (TD <= 3){
cout<<"Your Fare is 15.00 pesos"<<endl;
}
else if (TD <=6){
cout<<"Your Fare is 20.00 pesos"<<endl;
}
else if (TD <=10){
cout<<"Your fare is 25.00 pesos"<<endl;
}
else ( TD == 0); {
cout<<"Invalid "<<endl;
}
}
return 0;
getch();
}
Pa tulong po. Paano po gagawin para sa if statements ng fare lumabas? Di po kasi gumagana ang condition na naka Bold Font. Salamat po.