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.

You error is the fundamental language mistake. It is not possible
to declare any new variable or object in the scope of the switch statement that has outside scope. ifstream input("help.txt"); is not allowed.
Additionally, you have already declared input at the top
[4 lines below main()].

If you want to try this

switch(option) 
{
  case 'h':
   input.open("help.txt");
  break;
  .....
}

Further, you don't actually use input and output, but define a NEW
instance of output in the function CarParking.

perhaps you wanted this

int CarParking(std::ostream& output,const int min)
{
     int total = 0, time = 0, fees = 0;
      time = (min/60);
     // rest of your code
}

To open an output stream it is output.open("ParkingCharges.txt",ios::out); NOT: ofstream.output("Parking Charges.txt", ios::out); Because you are using a class name not an instance/object (ofstream is not an object) and you are using output which is not in the class or the public base classes.

The error says: "initialization skipped by case label."

You can circumvent that by ...

int main()
{
    ...
    switch(option)
    {
    case 'h':
    case 'H':
    {  // new scope begins here ...
        ...
	ifstream input("Help.txt");
        ...
    }	// ... and ends here
    break;
    ...
    }
    return 0;
}

Well I was able to resolve the problem
thanks for all the help though.

This question has already been answered. Start a new discussion instead.