I'm trying to figure out how to get info off of a 1 structure to use to get info from a second structure and use the info from the second to change the first. Here's some code hopefully explain it better.

struct weapons
{
	string name;
	int str;
};

struct user
{
	string name;
	int str;
	string weapon;
};

weapons sword_01 =
{
	"Nub Sword";
	5
}

user player_01 =
{
	CrAzD,
	0,
	"sword_01"
}

void setup()
{
	// I don't know what goes here but here's what I would like to do, obviously it doesn't work but hopefully it helps explain what I'm trying to figure out.
	player.str = player.weapon.str;
}

OK so I wrote out all your code into a new project and since this is just a short example I am going to give you what I got.

#include <iostream>
#include <string>

using namespace std;


struct weapons
{
	string name;
	int str;	
};

struct user
{
	string name;
	int str;
	weapons weapon;  //changed type of variable from string to your structure weapons
};

weapons sword_01 =
{
	"Nub Sword", //put comma not semicolon
	5
};

user player_01 =
{
	"CrAzD", //put in quotes (")
	0,
	sword_01
};

int main()
{
	player_01.str = player_01.weapon.str; //variable "player" does not exist

	cout << player_01.str << endl; //included to see if above line worked
	
	system("PAUSE");
	return 0;
}

Based on what you said you were looking for it looks like you want a weapons type variable in player instead of it being a string for what weapon you have.

I'm not sure if you were in a rush typing out your short example code or something but you made a bunch of small mistakes (see above code comments).

Thanks a lot, added it to the main code and it works perfectly xD and yeah all those simple errors are from me rushing.. That's what I get for rushing :/.

Thanks again though and for the quick response xD

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.