void init();
void tim();

int str;
int per;
int tou;
int rea;
int qui;
int wou;

void main()
{
		
	init();
	tim();
	cout<<"\nPerception-" <<per<<"\nStrength  -"<<str<<"\ntoughness -"<<tou<<"\nWounds    -"<<wou<<"\nQuickness -"<<qui<<"\nReactions -"<<rea;
	
	
	system ("pause");
	
}

void init()
{
	
	cout<<"You have 45 points to put into stats"<<"\nPerception-1pts. per \nStrength  -2pts. per \ntoughness -4pts. per \nWounds    -3 pts per \nQuickness -3pts. per \nReactions -1 pts. per \n";

	cout<<"These are your stats";
	cout<<"\nPerception-";
	cin>>per;
	cout<<"\nStrength  -";
	cin>>str;
	cout<<"\ntoughness -";
	cin>>tou;
	cout<<"\nWounds    -";
	cin>>wou;
	cout<<"\nQuickness -";
	cin>>qui;
	cout<<"\nReactions -";
	cin>>rea;
	cout<<per<<str<<tou<<wou<<qui<<rea;
	system ("pause");
	return;

}

I've tried multiple ways to do this. Basically i want the program to go to init() for the user to enter the stats and return the values back. -declaration errors right now.

what would putting the values like this do? void init(int per, int str, int wou....)
I did this, but had the values changing back to 0 once it got back to main. I'm not sure if i shouldve done something else or not.

when you pass an argument to a function like this

#include <iostream>

void init( int );

int main()
{
   int per = 0;

   std::cout << per << std;:endl;
   init( per );
   std::cout << per << std;:endl;

   return 0;
}

void init( int per )
{
   per = 10;
}

You will always see the result 0 . This is because the function creates a local copy of the variable per to use inside the function. If you want to modify the value inside the function so that the original is changed, you need to "pass-by-reference":

#include <iostream>

void init( int& );

int main()
{
   int per = 0;

   std::cout << per << std;:endl;
   init( per );
   std::cout << per << std;:endl;

   return 0;
}

void init( int& per )
{
   per = 10;
}

Notice the extra & in the argument list.

Thank you for that, i remember pass by reference now and re understanding local/global stuff again. i took c++ back in high school 8 years ago..
The & and * i wasnt sure of.

void main() is incorrect; if your compiler doesn't complain, throw it away and get a modern, better one for free.

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.