c:\documents and settings\daniel\my documents\visual studio 2008\projects\learn c++\learn c++\main.cpp(21) : error C3861: 'tutorial': identifier not found
#include <iostream>
#include <string>
using namespace std;
int source;
int tutorialstage = 1;
int life = 1;
string command;
size_t found;
int main()
{
cout << "You wake up to the buzz of the alarm clock. You reach over and hit the snooze button and try to go back to sleep. But it's impossible, once your up, you can't go back to sleep. You roll out of bed, adjusting your eyes to the light peeping through the curtains." << endl << endl << "7:00 am...too early." << endl << endl << "You glance over at the clock, and recoil in horro when you see that in fact the time is 8:00. The alarm must have been set wrong. Hurriedly you get dressed and run out the door." << endl << endl << "As you reach the school gates you hear a group of chavs call 'Run, Forest, Run.'" << endl << endl << endl << "[The next stage is the tutorial. If you get stuck at any time, type '/help'. If you wish to exit the game type '/exit'. If you see this sign: (>), type 'continue' to carry on." << endl << endl;
do {
getline (cin,command);
cout << ">>> ";
if (tutorialstage != 0)
{
tutorial (); //THIS IS LINE 21!!!!!!
}
#include <iostream>
#include <string>
usingnamespace std;
void tutorial ()
{
cout << "Meh";
}
int source;
int tutorialstage = 1;
int life = 1;
string command;
size_t found;
int main()
{
cout << "You wake up to the buzz of the alarm clock. You reach over and hit the snooze button and try to go back to sleep. But it's impossible, once your up, you can't go back to sleep. You roll out of bed, adjusting your eyes to the light peeping through the curtains." << endl << endl << "7:00 am...too early." << endl << endl << "You glance over at the clock, and recoil in horro when you see that in fact the time is 8:00. The alarm must have been set wrong. Hurriedly you get dressed and run out the door." << endl << endl << "As you reach the school gates you hear a group of chavs call 'Run, Forest, Run.'" << endl << endl << endl << "[The next stage is the tutorial. If you get stuck at any time, type '/help'. If you wish to exit the game type '/exit'. If you see this sign: (>), type 'continue' to carry on." << endl << endl;
do {
getline (cin,command);
cout << ">>> ";
if (tutorialstage != 0)
{
tutorial (); //THIS IS LINE 21!!!!!!
}
found=command.find("go");
if (found == 0)
{
cout << "Go where?";
}
found=command.find("exit");
if (found == 0)
{
life = 0;
}
} while (life == 1);
}
C++ reads code line for line, so when you put that void at the end it wont read it till the end, therefore it thought u hadnt declared tutorial();
i did the same thing with a struct. :P hope that helpys you out.
Do u mean call the void tutorial function from another source file? i wouldnt know how to do that. File I/O cmds would probably work for that sort of thing though.