thesonyman101 thesonyman101 - 10 months ago 37
C++ Question

I can't get this simple c++ script to compile. Any ideas?

Im learning c++ and am a noob at it any help would be nice. :)
This is a text based rpg that im messing with. Making a rpg is a great way to learn a language. But any help would be appreciated.

#include <iostream>

using namespace std;

int main()
int health, armor, damage;
health = 100;
armor = 0;
damage = 5;// This is a dynamic var for desision making
int loopcon = 1;
int decision = 1;

cout << "You enter the forest and have no idea what has happened and your head hurts.\n";
cout << "You are trying to remember whaT happened to you and how you ended up here but you cant.\n";
cout << "You see a town would you like to explore it?";
cout << "What is your name?";
while (loopcon == 1) {
cout << "1/0";
cin >> decision;
if (decision == 1)
cout << "You enter the city";
if (decision == 0)
cout << "Theres also a forsest want to export that?";

cout << "try useing caps";


return 0;

when I run this is get a big long error any ideas?


You commented out the standard namespace... Change

//using namespace std;


using namespace std;

Edit: your compiler is telling you exactly what's wrong... It can't find a reference to the std namespace functions because you haven't declared it. But note that it is bad practice to be declaring it globally. When you gain more familiarity with the language you should be declaring the namespace manually using the scope resultion :: operator.