hey guys im a beginner in C++ and its ganna show :p but here is my code....and when you run it you'll see what im getting..im not really sure whats going on
please any help on this mess would be great, first i dont know why im getting a smiley face when im trying to get the players name to show...and the next big problem is why it is showing both "case :" statements when you select one of the choicesCode:#include<iostream>
#include<string>
#define cls system("cls");
#define pause system("pause");
using namespace std;
int clSel();
class player1{
public:
char name[0];
int classSel;
string type;
};
int main()
{
player1 play1;
cout<<"Please enter player 1's name: ";
cin>>play1.name;
clSel();
}
int clSel()
{
cls
player1 play1;
cout<<play1.name<<"Please Select a Class...\n";
cout<<"1)Knight\n";
cout<<"2)Mage\n";
cin>>play1.classSel;
switch(play1.classSel)
{
case 1:{
play1.type = "Knight";
cout<<play1.name<<" Has Selected to Be A "<<play1.type<<endl;
pause
}
case 2:{
play1.type = "Mage";
cout<<play1.name<<" Has Selected to Be A "<<play1.type<<endl;
pause;}
default:{
cout<<"ERROR\n";
play1.classSel = 0;
clSel();}
}
}
if you guys could please help me out and let me know whats going on that would be awesome! thanks