Console RPG problem

Hi , i am tring to do a console RPG using Visual C++.
Here is my source code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include <iostream>
#include <cmath>
#include <cstdlib>

using namespace std ;

class HeroChar
{
protected:
   int AttackPoints ;
   int HealthPoints ;
   int HeroLvl ;
 void SetHChar()
 {
	 AttackPoints = 30  ;
	 HealthPoints = 100 ;
     HeroLvl = 1 ;
  };
};
class Monster1Char
{
protected:
    unsigned int AttackPoints;
    unsigned int HealthPoints;
	unsigned int Monster1Lvl;
	void SetMonster1Char()
	{

		AttackPoints = 10 ;
		HealthPoints = 55 ;
		Monster1Lvl = 1 ;

	};
};
class Dungeons
{
public:
	void FormatingDungeon(){
		unsigned int rand1;
		unsigned int coloana;
		char FormatingDungeons[50][40]
"###############################################",
"#                                             #",                                 
"#                                             #", 
"#                                             #",
"#                                             #",
"#                                             #", 
"#                                             #",  
"###############################################", };
for ( rand1 = 0 ; rand1 <= 50 ; rand1++)
{
		for ( coloana = 0 ; coloana <=8 ; coloana++)
		{
		char FormatedDungeon[rand1][coloana]  =  ForamtingDungeonos[rand1][coloana];

		}
}

		void GetFormatedDungeonos (unsigned int rand1 , unsigned int coloana){
			return FormatedDungeon [rand1][coloana];
		};
		
	};
};
 	 

int main()
{
	cout<<"Hi"<<endl;

	system("PAUSE");
	return 0 ;

}


is not finish yet but every time i am tring to build the application i see tihs errors:
------ Build started: Project: MyRPG, Configuration: Debug Win32 ------
Compiling...
MyRPG.cpp
c:\documents and settings\paul\my documents\visual studio 2008\projects\myrpg\myrpg\myrpg.cpp(50) : error C2059: syntax error : 'for'
c:\documents and settings\paul\my documents\visual studio 2008\projects\myrpg\myrpg\myrpg.cpp(50) : error C2143: syntax error : missing ')' before ';'
c:\documents and settings\paul\my documents\visual studio 2008\projects\myrpg\myrpg\myrpg.cpp(50) : error C2238: unexpected token(s) preceding ';'
c:\documents and settings\paul\my documents\visual studio 2008\projects\myrpg\myrpg\myrpg.cpp(50) : error C2143: syntax error : missing ';' before '<='
c:\documents and settings\paul\my documents\visual studio 2008\projects\myrpg\myrpg\myrpg.cpp(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\documents and settings\paul\my documents\visual studio 2008\projects\myrpg\myrpg\myrpg.cpp(50) : error C2238: unexpected token(s) preceding ';'
c:\documents and settings\paul\my documents\visual studio 2008\projects\myrpg\myrpg\myrpg.cpp(50) : error C2143: syntax error : missing ';' before '++'
c:\documents and settings\paul\my documents\visual studio 2008\projects\myrpg\myrpg\myrpg.cpp(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\documents and settings\paul\my documents\visual studio 2008\projects\myrpg\myrpg\myrpg.cpp(50) : error C2059: syntax error : ')'
c:\documents and settings\paul\my documents\visual studio 2008\projects\myrpg\myrpg\myrpg.cpp(51) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
c:\documents and settings\paul\my documents\visual studio 2008\projects\myrpg\myrpg\myrpg.cpp(42) : error C2143: syntax error : missing ';' before 'string'
c:\documents and settings\paul\my documents\visual studio 2008\projects\myrpg\myrpg\myrpg.cpp(49) : error C2059: syntax error : '}'
c:\documents and settings\paul\my documents\visual studio 2008\projects\myrpg\myrpg\myrpg.cpp(60) : error C2065: 'FormatedDungeon' : undeclared identifier
c:\documents and settings\paul\my documents\visual studio 2008\projects\myrpg\myrpg\myrpg.cpp(64) : error C2059: syntax error : '}'
c:\documents and settings\paul\my documents\visual studio 2008\projects\myrpg\myrpg\myrpg.cpp(64) : error C2143: syntax error : missing ';' before '}'
c:\documents and settings\paul\my documents\visual studio 2008\projects\myrpg\myrpg\myrpg.cpp(64) : error C2059: syntax error : '}'
Build log was saved at "file://c:\Documents and Settings\Paul\My Documents\Visual Studio 2008\Projects\MyRPG\MyRPG\Debug\BuildLog.htm"
MyRPG - 16 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
So , if you help me i will bee very thankfull
Last edited on
OK, here's what you do: you read each error message, go to the line it tells you the error is on, and fix the error. Then you compile the project again, after you've removed all the errors, and then it should run.

What the hell is this doing:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class Dungeons
{
public:
	void FormatingDungeon(){
		unsigned int rand1;
		unsigned int coloana;
		char FormatingDungeons[50][40]
"###############################################",
"#                                             #",                                 
"#                                             #", 
"#                                             #",
"#                                             #",
"#                                             #", 
"#                                             #",  
"###############################################", };
for ( rand1 = 0 ; rand1 <= 50 ; rand1++)
{
		for ( coloana = 0 ; coloana <=8 ; coloana++)
		{
		char FormatedDungeon[rand1][coloana]  =  ForamtingDungeonos[rand1][coloana];

		}
}

		void GetFormatedDungeonos (unsigned int rand1 , unsigned int coloana){
			return FormatedDungeon [rand1][coloana];
		};
		
	};
}; 

?
it's formating the walls of the dungeon
Last edited on
No it's not. Those strings are doing nothing, your indentation is all over the place and you end your function before the for loop starts. Shouldn't that look like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class Dungeons
{
    public:
        void FormatingDungeon(){
            unsigned int rand1;
            unsigned int coloana;
            char FormatingDungeons[50][40] = {
                "###############################################",
                "#                                             #",                                 
                "#                                             #", 
                "#                                             #",
                "#                                             #",
                "#                                             #", 
                "#                                             #",  
                "###############################################"
            };

            for ( rand1 = 0 ; rand1 <= 50 ; rand1++)
            {
                for ( coloana = 0 ; coloana <=8 ; coloana++)
                {
                    char FormatedDungeon[rand1][coloana]  =  ForamtingDungeonos[rand1][coloana];
                }
            }
        }

        void GetFormatedDungeonos (unsigned int rand1 , unsigned int coloana){
            return FormatedDungeon [rand1][coloana];
        }
};

?
Topic archived. No new replies allowed.