Hello everyone. I need help. C programming. Create at least two more functions except the main () function to collect them.
Use both to solve the problem below.
1) The parking fee calculation program for the parking lot was prepared.
2) For input, the parking time is input in hours and minutes. Minutes are raised in 10 minute increments.
(Example 1: If 2 hours 3 minutes is entered, it is calculated as 2 hours 10 minutes.
Example 2: If you input 3 hours 48 minutes, it counts as 3 hours 50 minutes.)
3) The fee is 1000 won per 10 minutes. However, it is 25,000 from 4 hours to 24 hours.
Calculate in won. After 24 hours, it is the amount calculated above and every 10 minutes thereafter.
1,000 won, 25,000 won will be added from 4 hours to 24 hours.
Becomes acid.
(Example 1: If you parked for 50 hours, it is calculated as 24 hours * 2 + 2 hours. Therefore,
25,000 * 2 + 1000 * 2 * 6 = 62,000 won.
Example 2: If you parked for 4 hours and 2 minutes, 25,000 won because you exceeded 4 hours.
Example 3: If you parked for 3 hours and 11 minutes, you can calculate the parking fee for 3 hours and 20 minutes.
1000 * (3 * 6 + 2) = 20,000 won.)​

Respuesta :

Answer:

Explanation:

#include <iostream>

using namespace std;

int costdays(int);

int costhrs(int,int);

int main()

{

   int dd,hh,mm,tmph,tmpd,tmpm=0;

   int pcost,mcost=0;

   cout<<"Enter Parking time" << endl;

   cout<<"Hours: ";

   cin>>hh;

   cout<<"Minutes: ";

   cin>>mm;

   

   if (mm>60)

   {

       tmph=mm/60;

       hh+=tmph;

       mm-=(tmph*60);

   }

   if (hh>24)

   {

       tmpd=hh/24;

       dd+=tmpd;

       hh-=(tmpd*24);

   }

   if ((hh>4)&&(mm>0))

   {

       pcost+=costdays(1);

   }

   else

   {

       mcost=costhrs(hh,mm);

   }

   cout<<"Total time: ";

   if (dd>0)

   {

       cout<<dd<<"days ";

       pcost+=costdays(dd);

   }

   pcost+=mcost;

   cout<<hh<<"h "<<mm<<"mins"<<endl;

   cout<<"Total Cost :"<<pcost<<"Won";

   return 0;

}

int costdays(int dd)

{

   return(dd*25000);

}

int costhrs(int hh,int mm)

{

   int tmpm, tmp=0;

   tmp=(hh*6)*1000;

   tmp+=(mm/10)*1000;

   tmpm=mm-((mm/10)*10);

   if (tmpm>0)

   {

       tmp+=1000;

   }

   return(tmp);

}

RELAXING NOICE
Relax