Every time I try to run my program I get and error that says "initialization of 'counter' is skipped by 'case' label" in line 113. I don't understand how to fix it.
//Name: Amanda Glavin
//Assignment: Converting Miles to Kilometers
//Date: July 6, 2015
//Lab: Midterm
int makeMilesKmTable;
double miles, kilometers;
int start, stop, quit;
int split = (start + stop)/2;
while (quit != 1)
{
// Display the menu.
cout << "1. Run one conversion of miles to kilometers." << endl;
cout << "2. Run many conversions of miles to kilometers." << endl;
cout << "3. Quit." << endl;
cout << endl;
// Promt the user for a selection
cout << "Enter your selection. " << endl;
cin >> makeMilesKmTable;
while (makeMilesKmTable < 1 || makeMilesKmTable > 4)
{
cout << "That is an invalid selection. " << endl;
cout << "Enter 1, 2, or 3." << endl;
cin >> makeMilesKmTable;
}
switch (makeMilesKmTable)
{
case 1:
cout << "Enter the number of miles. " << endl;
cin >> miles;
kilometers = miles * 1.61;
ofs << miles << "=" << kilometers << endl;
break;
case 2:
int counter = 0;
while(counter < 301)
cout << "Enter the number of miles." << endl;
cin >> miles;
kilometers = miles * 1.61;
ofs << miles << "=" << kilometers << endl;
counter++;
break;