Program Menghitung Ongkos Parkir C++
#include <iostream>
#include <conio.h>
using namespace std;
int JM, JK, OP, WP;
int main ()
{
cout<<"\t\t menghitung ongkos parkir \n";
cout<<"masukan jam masuk? ", cin>>JM;
cout<<"masukan jam keluar? ", cin>>JK;
{WP = JK-JM;
}
if (WP>1) {OP=(WP-1)*500+2000;}
if (WP<1) {OP=(WP+12)*500+2000;}
else {OP=2000*WP;}
cout<<"Ongkos Parkir? ";cout<<OP;
getch();
}
Matur Sembah Nuwun
#include <conio.h>
using namespace std;
int JM, JK, OP, WP;
int main ()
{
cout<<"\t\t menghitung ongkos parkir \n";
cout<<"masukan jam masuk? ", cin>>JM;
cout<<"masukan jam keluar? ", cin>>JK;
{WP = JK-JM;
}
if (WP>1) {OP=(WP-1)*500+2000;}
if (WP<1) {OP=(WP+12)*500+2000;}
else {OP=2000*WP;}
cout<<"Ongkos Parkir? ";cout<<OP;
getch();
}
Matur Sembah Nuwun
Komentar
Posting Komentar