switch.i need to make a pgrmm using this function and have to test it for a given time .but it is not work it!why?

#include <iostream>
using namespace std;
int main()
{
int x,charge;
float a,b,c,;
cout<<"case 1<=2hours,case2<=3hours,case3<=4hours,case4<=5hours,case5>6hours\n";
cout<<"pls enter your time entry\n";
cin>>a;
cout<<"pls enter your time exit\n";
cin>>b;
c=b-a;
cout<<"no of hours park is\n"<<c;
cout<<"pls enter no of case according to your no of parking hours\n";
cin>>x;

switch(x)
{
case 1:cout<< "the charge is RM2.00\n";break;
case 2:cout<< "the charge is RM3.00\n";break;
case 3:cout<< "the charge is RM4.00\n"; break;
case 4:cout<< "the charge is RM5.00\n";break;
case 5:cout<< "the charge is RM8.00\n";break;

default: cout<<"invalid hours of charge";break;
}
return 0;
}

test for
Time entry Time exit
08.20 09.15
10.30 13.45
11.15 16.30
12.01 19.45
closed account (9y8C5Di1)
What is it that does not work?
Write:
float a,b,c;

instead of
float a,b,c,;
Topic archived. No new replies allowed.