Question: how can I improve or make my code better #include #include int main ( ) { std :: string playername; std :: cout < <
how can I improve or make my code better
#include
#include
int main
std :: string playername;
std :: cout "Enter your player name: ;
std :: getlinestd :: cin, playername;
std :: cout "Welcome playername let's get you started on your way.
;
int choice;
const int wizard knight rogue ;
int magic strength ;
std :: cout "Enter the number of the character you want :
;
std :: cout Wizard magic, strength
;
std :: cout Knight magic, strength
;
std :: cout Rogue magic, strength
;
std :: cin choice;
ifchoice wizard
std :: cout "You have chosen the Wizard
;
magic ;
strength ;
else ifchoice knight
std :: cout "You have chosen the Knight
;
magic ;
strength ;
else ifchoice rogue
std :: cout "You have chosen the Rogue
;
magic ;
strength ;
else
std :: cout "Please enter a valid response
;
int item;
std :: cout "Enter the number of what item you want
;
std :: cout Sword of the Morning, this sword is granted only to those that are worthy, strength
;
std :: cout Necklace of Wisdom, this necklace offers the user enhanced wisdom, magic
;
std :: cout Solarflare Staff, a staff that allows the user fire magic, magic and strength
;
std :: cout Achilles bow, this bow is has accurate has they come, strength
;
std :: cout Jewel of frost, this jewel allows the user frost magic, magic
;
std :: cout Dagger of Sorrow, this blade yet small packs a mean punch, strength and magic
;
std :: cout Crossbow, trusty crossbow can never go wrong, strength
;
std :: cout Spellkeeper Book, this gook grants the user enhanced magical powers, magic
;
std :: cout Magic Wand, can't go wrong with a simple wand, magic
;
std :: cout Lighning spear, a spear that allows the user to summon mystical powers, magic and strength
;
std :: cin item;
std :: string itemName;
switchitem
case :
std :: cout "You have chosen the Sword of the Morning
;
itemName "Sword of the Morning";
strength ;
break;
case :
std :: cout "You have chosen the Necklace of Wisdom
;
itemName "Necklace of Wisdom";
magic ;
break;
case :
std :: cout "You have chosen the Solarflare Staff
;
itemName "Solarflare Staff";
magic ;
strength ;
break;
case :
std :: cout "You have chosen the Achilles bow
;
itemName "Achilles bow";
strength ;
break;
case :
std :: cout "You have chosen the Jewel of Frost
;
itemName "Jewel of Frost";
magic ;
break;
case :
std :: cout "You have chosen the Dagger of Sorrow
;
itemName "Dagger of Sorrow";
magic ;
strength ;
break;
case :
std :: cout "You have chosen the crossbow
;
itemName "Crossbow";
strength ;
break;
case :
std :: cout "You have chosen the Spellkeeper Book
;
itemName "Spellkeeper Book";
magic ;
break;
case :
std :: cout "You have chosen the Magic Wand
;
itemName "Magic Wand";
magic ;
break;
case :
std :: cout "You have chosen the Lighning Spear
;
itemName "Lightning Spear";
magic ;
strength ;
break;
default:
std :: cout "Please enter a valid response
;
return ;
std :: cout "Player stats:
;
std :: cout "Magic: magic std :: endl;
std :: cout "Strength: strength std :: endl;
std :: cout "Item: itemName std :: endl;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
