gives an error:
“Error C3867:” Game :: Chapter_one “: non-standard syntax; use” & amp; “to create a pointer to a member.”
I climbed the Internet, but I found little understandable … How to fix it?
Source.cpp file:
# include "Gameteh.h"
Using Namespace STD;
INT MAIN (Void) {
Game * Game = New Game;
SETLOCALE (LC_ALL, "RUS");
Game- & gt; Chapter_one;
cin.get ();
Delete Game;
Return 0;
}
File Gameteh.h:
# include & lt; iostream & gt;
#Include & lt; algorithm & gt;
#Include & lt; String & GT;
# INCLUDE & LT; Locale.h & gt;
# INCLUDE & LT; Windows.h & GT;
#Include & lt; stdio.h & gt;
Using Namespace STD;
Class Game {
Private:
STD :: String Player (String Player_Name) {
COUT & LT; & LT; "Enter the name" & lt; & lt; Endl;
CIN & GT; & GT; Player_Name;
Return 0;
}
Private:
Std :: String Lose_Round = "You lost the battle.";
STD :: STRING WIN_ROUND = "You won!";
STD :: STRING REPEAT = "Enter the dance number";
int index_rounds = 0;
STD :: String String_rounds = "Completed Rounds -" + Index_Rounds;
Public:
Void Chapter_one (int choise) {
COUT & LT; & LT; "Dark forest came around, \ n";
COUT & LT; & LT; "Suddenly out of the ground got out the mounds, \ n";
COUT & LT; & LT; "It was a slug. \ N";
COUT & LT; & LT; "What will you do? \ N";
COUT & LT; & LT; "1. Take a salt. \ N";
COUT & LT; & LT; "2. wave a sword. \ N";
COUT & LT; & LT; "3. Run. \ N";
CIN & GT; & GT; Choise;
Switch (Choise)
{
Case 1: Win_Round; Break;
Case 2: Lose_Round; index_rounds ++; String_Rounds; Break;
CASE 3: LOSE_ROUND; index_rounds ++; String_Rounds; Break;
Default: Repeat; Break;
}
}
};
Answer 1, Authority 100%
Edit
game * game = new game;
on
game * game = new game ();
and
game- & gt; chapter_one;
on
game- & gt; chapter_one (parameter);
The problem with the option to fix, you can:
...
Public:
void chapter_one () {
int choise = 0;
...
}
...
or if I forgot to C++ so:
int main (void) {
Game * game = new Game ();
int choise = 0;
game- & gt; chapter_one (choise);
}
...
void chapter_one (int & amp; choise) {...}