🔒 Closed Patulong po lodi para sa project namin

Status
Not open for further replies.

X4c3

Honorary Poster
Basic lang po alam ko sa c++... Sana po matulongan niyo ako, maraming salamat po... Yung 58 po lodis:).
received_1868896119839024.jpeg
received_1868896076505695.jpeg
received_1868896069839029.jpeg
 
Page 1 , gugel about rand function,
Ex:
/* random int between 0 and 19 */
int r = rand() % 20;
int guess;

Prompt the user to input :
cin>>guess;
If (guess < r)
Blocks of code
Else if (guess > r)
Blocks of code
Else
Youre guess is correct

Apply mo nalang yan
 
Sir bali ganto algo
Ung mga vehicles store to datatype char
For ex :
Meron tayong declaration
char v;
Enter vehicle type :
cin>>v
//store the input in v
store the entry time and the left time

Sabi dun e pag si minute ay mas malaki kaysa dun sa isa bawasan ng 1 ang hr at add ng 60 ang minutes
Bale halimbawa :
5:20 left ------> 4 : 80
2:35 entry ----> 2 : 35
Tas tsaka mo compute ung difference sabi if more than 3 daw may bayad na
Ex:
if( timediff > 3)
Blocks of code
Time diff * 1.5
And so on hope na makatulong
 
/******************************************************************************

Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()

{
char type;
int henter,menter,hleft,mleft,pt,pm;
int htotal,mtotal;
double total;
cout<<"Type of vehicle :";
cin>>type;
cout<<"Hour vehicle entered lot (0-24):";
cin>>henter;
cout<<"Minute vehicle entered lot (0-60):";
cin>>menter;
cout<<"Hour vehicle left lot (0-24):";
cin>>hleft;
cout<<"Minute vehicle left lot (0-60):";
cin>>mleft;
switch(type){
case 'c':
if (mleft < menter){
//--check if min. left is greater than min. enter
hleft = hleft - 1 ;
mleft = mleft + 60;
//--calculate for the diffrence of time in and time out
htotal = hleft - henter;
mtotal = mleft - menter;
//-- if hours is greater than 3
//--multiply 1.5 for the next hour
if (htotal >= 3){
total = htotal * 1.5;
}
else {
total = htotal * 0;
}

}
else {
htotal = hleft - henter;
mtotal = mleft - menter;
//-- if hours is greater than 3
//--multiply 1.5 for the next hour
if (htotal >= 3){
total = htotal * 1.5;
}
else {
total = htotal * 0;
}

}
break;
case 't':
//gayahin mo nalang ung nasa taas bali i change mo nalng ung htotal >= x
//x ay depende kung ilang oras mag sstay copy mo lang at edit depende sa price per hour
break;
case 'b':
//gayahin mo nalang ung nasa taas bali i change mo nalng ung htotal >= x
//x ay depende kung ilang oras mag sstay copy mo lang at edit depende sa price per hour
break;
default:
cout<<"Check your input ! ";
break;
}
cout<<"Type of vehicle:"<<type<<endl;
cout<<"TIME-IN :"<<henter<<":"<<menter<<endl;
cout<<"TIME-OUT :"<<hleft<<":"<<mleft<<endl;
cout<<"----------------------------"<<endl;
cout<<"PARKING TIME :"<<" "<<htotal<<":"<<mtotal<<endl;
cout<<"Rounded total:"<<htotal<<endl;
cout<<"----------------------------"<<endl;
cout<<"Total Charge:"<<total<<endl;


}
 
Status
Not open for further replies.

Similar threads

About this Thread

  • 16
    Replies
  • 802
    Views
  • 5
    Participants
Last reply from:
PHC-M4tR1x

Trending Topics

Online now

Members online
1,142
Guests online
1,362
Total visitors
2,504

Forum statistics

Threads
2,273,440
Posts
28,949,507
Members
1,235,747
Latest member
_usteng_
Back
Top