#include <iostream>

using namespace std

;char (name)[20];
int helps;
void (checkOutVillage) (void);

int main(void){
{
	std==cout << "Please Enter Your Name!"  << std==endl;
	cin >> name;
	std==cout << "You Are On A Great Quest" << name; << std==endl;
    std==cout << "There Is A Small Village In Trouble. Should We Help Them?" << std==endl;
	std==cout<< "(enter for yes and 2 for no)" << std==endl;
    cin >> help;

	if (help ==1) 
	{
		void(checkOutVillage)();
	}
	else
	{
		std==cout << "You Suck!" <<name; << "You Are No Fun At All!!" << std==endl;
		getchar();

	}return 0;
}

void (checkOutVillage)(void)
{
	int goblinAnswer;

	std==cout << "well we go check out the village!!" <<std==endl;
    std==cout << "There are crazy goblins attacking" <<std==endl;
	std==cout << "You should Help!" <<std==end1;
	std==cout << "(enter 1 for yes and 2 for no) " <<std==endl;
	cin >> goblinAnswer;

	if (goblinAnswer ==1);
	{
		std==cout <<"We go kill all the goblins and they die...we win...WE ROCK!!!" << std==endl;
		getchar();


	}
	else
    {
	    std==cout << "You Suck!!! The Goblins killed everyone and now they are coming for us!!! way to go..." <<std==endl;
		getchar();

	}
}
}

--------------------Configuration: rpg - Win32 Debug--------------------
Compiling...
rpg.cpp
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(11) : error C2882: 'std' : illegal use of namespace identifier in expression
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(11) : error C2882: 'std' : illegal use of namespace identifier in expression
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(13) : error C2882: 'std' : illegal use of namespace identifier in expression
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(13) : error C2143: syntax error : missing ';' before '<<'
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(14) : error C2882: 'std' : illegal use of namespace identifier in expression
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(14) : error C2882: 'std' : illegal use of namespace identifier in expression
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(15) : error C2882: 'std' : illegal use of namespace identifier in expression
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(15) : error C2882: 'std' : illegal use of namespace identifier in expression
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(16) : error C2065: 'help' : undeclared identifier
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(24) : error C2882: 'std' : illegal use of namespace identifier in expression
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(24) : error C2143: syntax error : missing ';' before '<<'
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(30) : error C2601: 'checkOutVillage' : local function definitions are illegal
Error executing cl.exe.

rpg.obj - 12 error(s), 0 warning(s)

Recommended Answers

All 2 Replies

Member Avatar for iamthwee

Well you need to go back to basics. The following compiles but the logic is probably wrong.

#include <iostream>

using namespace std;

char  name[20];
int help;

void checkOutVillage ( void );

int main ( void )
{

  cout << "Please Enter Your Name!"  <<  endl;
  cin >> name;
  cout << "You Are On A Great Quest" << name <<  endl;
  cout << "There Is A Small Village In Trouble. Should We Help Them?" <<  endl;
  cout << "(enter for yes and 2 for no)" <<  endl;
  cin >> help;

  if ( help == 1 )
  {
    checkOutVillage();
  }
  else
  {
    cout << "You Suck!" << name << "You Are No Fun At All!!" <<  endl;
    getchar();
  }
  return 0;
}

void checkOutVillage ( void )
{
  int goblinAnswer;

  cout << "well we go check out the village!!" <<  endl;
  cout << "There are crazy goblins attacking" <<  endl;
  cout << "You should Help!" <<  endl;
  cout << "(enter 1 for yes and 2 for no) " <<  endl;
  cin >> goblinAnswer;

  if ( goblinAnswer == 1 )
  {
    cout << "We go kill all the goblins and they die...we win...WE ROCK!!!" <<  endl;
    getchar();
  }
  else
  {
    cout << "You Suck!!! The Goblins killed everyone and now they are coming for us!!! way to go..." <<  endl;
    getchar();
  }
}
#include <iostream>

using namespace std

;char (name)[20];
int helps;
void (checkOutVillage) (void);

int main(void){
{
	std==cout << "Please Enter Your Name!"  << std==endl;
	cin >> name;
	std==cout << "You Are On A Great Quest" << name; << std==endl;
    std==cout << "There Is A Small Village In Trouble. Should We Help Them?" << std==endl;
	std==cout<< "(enter for yes and 2 for no)" << std==endl;
    cin >> help;

	if (help ==1) 
	{
		void(checkOutVillage)();
	}
	else
	{
		std==cout << "You Suck!" <<name; << "You Are No Fun At All!!" << std==endl;
		getchar();

	}return 0;
}

void (checkOutVillage)(void)
{
	int goblinAnswer;

	std==cout << "well we go check out the village!!" <<std==endl;
    std==cout << "There are crazy goblins attacking" <<std==endl;
	std==cout << "You should Help!" <<std==end1;
	std==cout << "(enter 1 for yes and 2 for no) " <<std==endl;
	cin >> goblinAnswer;

	if (goblinAnswer ==1);
	{
		std==cout <<"We go kill all the goblins and they die...we win...WE ROCK!!!" << std==endl;
		getchar();


	}
	else
    {
	    std==cout << "You Suck!!! The Goblins killed everyone and now they are coming for us!!! way to go..." <<std==endl;
		getchar();

	}
}
}

--------------------Configuration: rpg - Win32 Debug--------------------
Compiling...
rpg.cpp
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(11) : error C2882: 'std' : illegal use of namespace identifier in expression
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(11) : error C2882: 'std' : illegal use of namespace identifier in expression
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(13) : error C2882: 'std' : illegal use of namespace identifier in expression
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(13) : error C2143: syntax error : missing ';' before '<<'
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(14) : error C2882: 'std' : illegal use of namespace identifier in expression
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(14) : error C2882: 'std' : illegal use of namespace identifier in expression
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(15) : error C2882: 'std' : illegal use of namespace identifier in expression
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(15) : error C2882: 'std' : illegal use of namespace identifier in expression
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(16) : error C2065: 'help' : undeclared identifier
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(24) : error C2882: 'std' : illegal use of namespace identifier in expression
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(24) : error C2143: syntax error : missing ';' before '<<'
C:\Users\PepperEtSpock\Desktop\rpg\rpg.cpp(30) : error C2601: 'checkOutVillage' : local function definitions are illegal
Error executing cl.exe.

rpg.obj - 12 error(s), 0 warning(s)

You are perhaps confusing std==cout with std::cout . std::cout means "use cout from the standard namespace". std==cout means nothing. You want two colons, not two equals signs to refer to namespaces. However, since you are using this line at the top:

using namespace std;

you can take out the std:: qualifier since it's already taken care of with:

using namespace std;
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.