So I've been working through the C++ tutorial on this site by trying to slowly add the concepts I'm learning into a text adventure. I had previously made a series of if statements that allowed the player to check their stats and environment, and rather than copy it out into the main function again and again, I thought it would be neat to turn it into a function so I could just call it up whenever the player had the option to look at their stats. What I brewed up for my function was this (I plan to add more options for the variable in the if statement as I go on so the result changes as the variables change through player actions):
Code:
//
//
void breathedeep (int weapon, int room, int healthstat, int spiritstat, int strengthstat, int dexteritystat)
{
cout << "You take a deep breath, close your eyes and look inward. You have a brief moment of deep awareness. \n Health: "<< healthstat << "\n Spirit:" << spiritstat << "\n Strength: " << strengthstat << "\n Dexterity: " << dexteritystat << "\n";
if (weapon == 0)
{
cout << "You're completely unshod, and unarmed.";
}
if (room == 1)
{
cout << "You are in some sort of clinic. It is tidy and neat, but doesn't appear to have much in the way of medical supplies. Everything is worn down, but obvious efforts have been made to maintain what little is there. A mare in an orange vest resides here, looking watchful.";
}
}
//
//
I inserted it into main when the option to look at your inventory came up like so:
Code:
//
//
if (tutorialchoiceone == 1)
{
cout << int breathedee (weapon, room, healthstat, spiritstat, strengthstat, dexteritystat) << "\n"; // I get two error messages on this line, one that says that the program expected a primary-expression before 'int' and another that says that it expected a ; before 'int'.
}
//
//
It seems to fit with what the tutorial on this site described, and I have tried several modifications to the line, but nothing seems to let my program compile. I also tried googling what a primary-expression was in C++ terminology, but I couldn't seem to find a straight answer to that either.
Would any of you more experienced and (I can only presume) mind bogglingly intelligent programmers be able to help a poor newbie out?
Edit: I noticed the missing "p" at the end of my variable in the function call, but I still got the same issue.