Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

How to pass structure values different between functions

$
0
0
struct NewPlayer
{
int level;
int intelligence;
int damage;

};

int CharacterInfo(NewPlayer MageWizard, int Clevel,int Cint, int Cdam)
{
cin >> Clevel;
cin >> Cint;
cin >> Cdam;
}

//*****************************************************************
I need a seperate function here that will inherit the values from the 
structure in the function above.My problem is I dont know how to create 
a seperate function that will grab the values of the structure
from CharacterInfo(NewPlayer MageWizard, int Clevel,int Cint, int Cdam)
to later be called upon in int main()

***The purpose of the seperate function is to use the structure values
from the function above to forumlate an equation that will return a single
integer value that will later be displayed in int main()
//******************************************************************

int main()
{
NewPlayer Wizard;
int Flevel, Fdamage, Fintelligence;

CharacterInfo(Wizard, Flevel, Fdamage, Fintelligence)

//*********************************************************
use the new function here to display the returned int value
//*********************************************************
}


Thank you for your time,help, and consideration.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>