Hi everyone,
I have worked some more on my code and this time I am getting some error that I am not able to resolve. Please help me.
The error says: "initialization skipped by case label." Please show me how to resolve this.
Here is the code. The error has a remark in red.
// Hw6_Bhasin.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include<fstream>
#include<iomanip>
#include<stdlib.h>
using namespace std;
int CarParking(int);
int main()
{
int minutes = 0;
char option = '\0', user;
ifstream input;
ofstream output;
cout<< setiosflags(ios::left)<< "\t \t \t UH Visitors Parking "<<endl;
cout<< setiosflags(ios::left)<< "_______________________________________________________________"<<endl;
cout<<"\n"<<setiosflags(ios::right)<< "\t Help \t Car \t MotorCycle \t SeniorCitizen \t Quit";
cout<<"\n"<<setiosflags(ios::left)<<"_______________________________________________________________"<<endl;
cout<<"Please select an option from above."<<endl;
cin>> option;
switch(option)
{
case 'h':
case 'H':
ifstream input("Help.txt");
break;
case 'c':// Error C2360: initialization skipped by case label.
case 'C': // same error here as well.
cout<<"Please input the number of minutes you were parked in the lot."<<endl;
cin>> minutes;
CarParking( minutes);
ofstream.output("Parking Charges.txt", ios::out);
break;
}
return 0;
}
int CarParking(int min)
{
int total = 0, time = 0, fees = 0;
ofstream output;
time = (min/60);
total = (time%2);
fees = time + total;
cout<< " Hours parked: "<<time<<endl;
cout<<"Your parking fees: "<<fees<<endl;
cout<<"Thankyou for using UH Visitors Parking.\n";
cout <<" Have a nice day."<<endl;
output<< " \t UH Visitors Parking"<<endl;
output<< " Hours parked: "<<time<<endl;
output<<"Your parking fees: "<<fees<<endl;
output<<"Thankyou for using UH Visitors Parking.\n";
output<<" Have a nice day."<<endl;
return fees;
}
Really appreciate your help.
Thanks.