I am having trouble finding any errors in this code in Visual Studio. Can you help me to find them and correct them? It would be very much appreciated. Here is the code:
#include "stdafx.h"
#include <iostream>
using namespace std;
int main(void)
{
char selection;
cout<<"\n Welcome to dance class. Please select which class you want to be in.";
cout<<"\n========";
cout<<"\n A - Bollywood";
cout<<"\n M - Salsa";
cout<<"\n D - Ballet";
cout<<"\n X - Go back to menu";
cout<<"\n Enter selection: ";
// read the input
cin>>selection;
switch(selection)
{
case 'A' :
case 'a' :{cout<<"\n The cost for adult beginner is 4 pounds\n";}
break;
case 'M' :
case 'm' :{cout<<"\n The cost for adult intermediate is 5 pounds";}
break;
case 'D' :
case 'd' :{cout<<"\n The cost for adult advanced is 5 pounds 50.";}
break;
case 'X' :
case 'x' :{cout<<"\n To go back to the menu";}
break;
// other than A, M, D and X...
default : cout<<"\n Invalid selection";
// no break in the default case
}
char selection;
cout<<"\n Please select the difficulty desired for the dance class.";
|| foo.cpp: In function ‘int main()’:
foo.cpp|39 col 7| error: redeclaration of ‘char selection’
foo.cpp|5 col 7| note: ‘char selection’ previously declared here