apemax Posted March 9, 2010 Share Posted March 9, 2010 I have been trying to think of a program to make with C++ to help me learn it better but i can't think of anything. any suggestions? it doesn't matter what type of program just something. :) Link to comment Share on other sites More sharing options...
Addictgamer Posted March 9, 2010 Share Posted March 9, 2010 Make a simple text based MUD. Those are a good idea if you have any plans to so game programming. Although...There are many things you can try now. Some are probably easier and better. Link to comment Share on other sites More sharing options...
apemax Posted March 10, 2010 Author Share Posted March 10, 2010 thats a good idea. Although...There are many things you can try now. Some are probably easier and better. /quote] like? :) Link to comment Share on other sites More sharing options...
Addictgamer Posted March 10, 2010 Share Posted March 10, 2010 Write a tool that copies files from one location to another. Write a tool that deletes files. Write a tool that shows the name of the drive that it is located in. Write a simple command response text game. Write a cli map editor. Write a program that draws ascii maps from the file created by the cli editor. Write an ascii game that uses maps from the file created by the cli editor. Link to comment Share on other sites More sharing options...
apemax Posted March 10, 2010 Author Share Posted March 10, 2010 ok. sorry its probably obvious but what is a cli map editor? :) Link to comment Share on other sites More sharing options...
Addictgamer Posted March 10, 2010 Share Posted March 10, 2010 cli stands for command line interface. So, here is an example of a cli map editor: (It's actually virtual world's test map creator. new one is being made with a gui) #include <iostream> #include <fstream> #include <string> #include <stdio.h> using namespace std; //The number of rows in the map #define ROWS 200 //The number of columns in the map #define COLS 200 int main() { int tile_array[ROWS][COLS]; for(int r = 0; r < ROWS; ++r) { for(int c = 0; c < COLS; ++c) { tile_array[r][c] = 0; } } string temp; cout << "Type 0 for dirt, 1 for grass\n"; for(int r = 0; r < ROWS; ++r) { for(int c = 0; c < COLS; ++c) { cout << "Tile: " << r << " " << c << " = "; cin >> temp; if(temp == "1") { tile_array[r][c] = 1; } else { tile_array[r][c] = 0; } cout << endl; } } cout << "Enter the output filename: "; cin >> temp; cout << endl; ofstream temp2(temp + ".map"); for(int r = 0; r < ROWS; ++r) { for(int c = 0; c < COLS; ++c) { if(tile_array[r][c] == 1) { temp2 << "grass\n"; } else if(tile_array[r][c] == 0) { temp2 << "dirt\n"; } else { temp2 << "dirt\n"; } } } temp2.close(); return 0; } It is just an example of how it could be programmed. Link to comment Share on other sites More sharing options...
apemax Posted March 11, 2010 Author Share Posted March 11, 2010 I tried to compile it just to see what it did and i got this error message: c:\documents and settings\user\my documents\visual studio 2008\projects\cli map editor\cli map editor\main.cpp(49) : error C2664: 'std::basic_ofstream<_Elem,_Traits>::basic_ofstream(const char *,std::ios_base::openmode,int)' : cannot convert parameter 1 from 'std::basic_string<_Elem,_Traits,_Ax>' to 'const char *' with [ _Elem=char, _Traits=std::char_traits<char> ] No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called Link to comment Share on other sites More sharing options...
Addictgamer Posted March 11, 2010 Share Posted March 11, 2010 It works fine for me. What compiler did you use? Ah, so the line it is messing up on is ofstream temp2(temp + ".map") Hmm...I still don't get this error... Are you by any chance using linux? I still don't think there would be any compatibility problems for this program on linux. Link to comment Share on other sites More sharing options...
apemax Posted March 11, 2010 Author Share Posted March 11, 2010 I am using microsoft visual C++ 2008 on windows xp sp3. Link to comment Share on other sites More sharing options...
Addictgamer Posted March 11, 2010 Share Posted March 11, 2010 I am using microsoft visual C++ 2008 on windows xp sp3. I first compiled this code on my xp laptop with msvc++ 2008. Worked fine. Hmm...Try compiling the program with release configuration. Oh wait, I didn't post an important header I think. Let me check...I think I left out some code. EDIT: Nope, all the code is there. Try compiling release configuration then... Link to comment Share on other sites More sharing options...
apemax Posted March 12, 2010 Author Share Posted March 12, 2010 I get the same error with release configuration too. Link to comment Share on other sites More sharing options...
Addictgamer Posted March 12, 2010 Share Posted March 12, 2010 Weird, I don't get it at all. Try using another compiler and see if it compiles. Link to comment Share on other sites More sharing options...
apemax Posted March 13, 2010 Author Share Posted March 13, 2010 I tried it with dev C++ IDE with the mingw32 compiler and it gave this error message when i tried to compile it. Link to comment Share on other sites More sharing options...
Addictgamer Posted March 13, 2010 Share Posted March 13, 2010 I always get that error compiling virtual world with mingw. A slightly modified version though... Let me see if the map creator compiles in mingw. Link to comment Share on other sites More sharing options...
Recommended Posts