We need to design a game for class and my group is storing all of the character's attributes in a struct. Below is the code that we have and visual studio gives us an error saying
error: class "std::basic_string<char,std::char_traits<char>, std::allocator<char>>" has no member "gold"
it gives us that error where i wrote name.gold = 0; is what i have correct for what i'm trying to do. the code below only creates the struct, declares the strings, starts the game, and gives the character a name that's user inputted.below that i have player name; which i believe declares that the player is the inputted variable name. is that the right way to do that? and below that it sets the value of gold to zero since you start with none. is that the correct way to do that? any help will be greatly appreciated. if you need any more information or clarification, let me know, i'll be happy to give any information you need.
#include <iostream>
#include <string>
using namespace std;
void clearScreen();
struct player{
int level;
int gold;
int health;
string magicPotion;
string strengthPotion;
string healthPotion;
string weapon;
string armor;
string spell;
};
int main ()
{