I cant round up minutes and switch them to hours?...for example if a car was parked for 241 minutes(input has to be in minutes) and rate was $2/hour and first 120 minutes were free i would need to charge for 5h and i dont know how to round up right so i could charge for 5h. please helpp.

so far

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
    //local constants
    const char CAR   = 'C';
    const char TRUCK = 'T';

    //local variables
    char type;                             //Car or truck
    int num;                                   //Minutes parked
    float total;                                 //Total

    /**************************start main program*********************/

   //Input whether its car or truck
   cout << "\n\n";
   cout << setw(45) << "-------------------------------"        << endl;
   cout << setw(45) << "Cost of Parking on OnCenter lot"        << endl;
   cout << setw(45) << "-------------------------------"        << endl;
   cout << setw(45) << "Vehicle Type (T for Truck C for Car):   " << endl;
   cin  >> type;

   if (type == 'C')
      {
      cout << setw(45) << " Minutes Parked:   ";
      cin  >> num;
      }
      if ( num <= 120 )        
         cout << setw(45) << " No Fee ";

      else if ( num > 120 )

int hours(minutes/60);
if( (minutes%60) > 0 ) ++hours;

Divide minutes by 60 for the number of hours, the conversion to the "int" type will floor the value (drop any decimal amount)
The % (modulus) operator returns a remainder of division. If your number of minutes is not divisible by 60, increase the number of hours by 1.

i really dont know where to put those things? im a beginner.

if ( num <= 120 )        
         cout << setw(45) << " No Fee ";
      else if ((num%60) > 0 ) ++hours;
      {
           int hours(num/60);
         cout << setprecision(2) << setiosflags(ios::fixed) << setiosflags(ios
              ::showpoint);    
         cout << setw(45) << "Total:   " << total;
         } 

??????????????????? this still doesnt work.
please helpp

thank youu

@Unimportant : hours(minutes/60) would act like a ground function and give 4 hours for 241 minutes and not five.(you need to increase minutes by 60 or add 1 to the hours value in order to make it act like a ceiling function i,e (241+60)/60 = 5 and (241/60)+1 = 5).

@nickx522:You have almost got it you can work around like this:

//Only a psuedocode
if(min <= 120)
   // print it as free parking
else
{
    //Increase minutes by 60 so that when you divide it by 60 you get the effect of ceiling function and not of a ground function
    min+=60;
    int hours(min/60);
    //Now you have the hours for which you need to charge 
}

i didnt even learn ceiling function yet?

can you just help me to code it? i only can use if and else.

ive been trying to get this to work for past 4h! and i cant figure it out.

if (type == 'C')
      {
      cout << setw(45) << " Minutes Parked:   ";
      cin  >> num;
      }
      if ( num <= 120 )        
         cout << setw(45) << " Free Parking ";
       else
          {
          num+=60;
          num = num-120;
          total = (num/60)* 1.75;
          cout << "Total: " << total;
          }

this seem to work. is it correct?

@csurfer, read the rest of my post.
I did that on purpose, and then used the modulus operator to add 1 to hours if minutes does not divide evenly into 60.
241/60 AS INT -> 4
241%60 != 0 -> 4 becomes 5

but if number of minutes was 240:
240/60 is still 4
240%60 == 0 -> 4 stays 4

if the number was 239
239/60 is 3 as int
239%60 != 0 -> 3 becomes 4

Also, please use code tags to preserve tabs

if (type == 'C') {
  cout <<"\nMinutes Parked: \n";
  cin >> num;
}
if ( num <= 120 ) {
  cout << "Free Parking\n";
} else {
  total = (num-120)/60; // don't know what the 1.75 was about
  if( num%60!=0 ) ++total;
  cout << "Total: " << total << "\n";
}

Edit: You can probably even drop the != 0, and use the line:

if(num%60)++total;

Due to the fact that 0 evaluates to false, and any other value evaluates to true, but this might be less clear readability wise.

thank you soo much everyone!!

this works!!

   //Input whether its car or truck
   cout << "\n\n";
   cout << setw(50) << "---------------------"        << endl;
   cout << setw(50) << "OnCenter Parking Cost"        << endl;
   cout << setw(50) << "---------------------"        << endl;
   cout << "\n";
   cout << setw(58) << "Vehicle Type (T for Truck C for Car):  ";
   cin  >> type;
   cout << "\n";
     if (type == 'c') 
     {
        cout << setw(57) << " Minutes Parked                      : ";
        cin >> num;
     }
     //Clear the screen
    system("cls");

     if ( num <= 120 ) 
        cout << setw(50) <<  "Free Parking" << endl;
      else 
          total_hours = (num-120)/60; 
     if ( num%60!=0 ) ++total_hours;
          {
          total_min   = total_hours + 2;           
          total = total_hours * CAR_FEE;
          cout << setw(47) << " RECEIPT ";
          cout << setw(80) << "---------";
          cout << "\n\n";
          cout << setw(50) << "Total Hours Parked :  " << total_min;
          cout << "\n\n";
          cout << setw(50) << "Cost for Parking   : $" << total;
          cout << "\n\n";
          cout << setw(50) << "Vehicle Type       :  " << "Car";
          cout << "\n";
}

}   //End main program

but this code is only if the user enters c for car, now i dont know where i need to insert if (type == 't') and write the code for the truck which is going to be similar. if someone could help me with that, it would be much appreciated.

Why not just do exactly what you just said?
Just put if(type=='t') and then the rest of the code for that case.

yeah when i do that all the elses and couts get executed too :(