project for an upstepping beginer

Hi Forum!

I have been learning the basics of C++ from some sources, and i have finished a book on them. Since i don't know what should be a good project for me, i made up my mind to ask you.
I know classes, pointer ect. But not indepth.

So i'm asking for a task to be solved, that is doable for me.

Thanks in advance.
I taught myself C++ so that I could make games.

So when I thought I had taught myself enough, I started to make basic games, i.e
Hangman
Tic Tac Toe
Guessing games, etc.

Even if it's a bit above what you know, it's good to do things like this, as you'll learn more in the process of making these games/programs, rather than going over and over the stuff you already know.

This is from my point of view though, I like to learn by testing rather than repeating old stuff.

When you run in to a problem that you don't know about, you can focus on that problem as the other basic stuff is already known.

EDIT:
So when I thought I had taught myself enough
- A quote from me! ahaha. I still don't know enough!!
Last edited on
Wow, any of those would be a big project for me. I guess the easiest would be Hangman. I should make an array of chars and than check them one by one, if they match with the guessed letter. Anyway, if i don't know something i should look it up in msdn shouldn't I?

I will get back as soon as i made any progress. These things look complicated.

PS: How long have you been into C++? Why don't you move onto Windowsprograming?
Yeah, I use MSDN for most things, or this site( which has a better understanding of the question! lol )

I've been playing with it, on and off for about 2 years now. And yeah, I started making Win32 Apps about 2 weeks ago.

If you are interested, take a look here:
http://sites.google.com/site/davevisone/

It's things I've made in c++. Not the best coding ever, and hopfully not the worst :P but hopefully you could learn something from it ( That's why it's there ). Sometimes I think it's a good idea to look at full source code to learn.

That way, you can get the idea from it, adapt it if it's not the way you like/understand it. And hopfully learn something from.
It's funny, if i take a look at your tictac toe code, how long is it to make such a simple looking program.

Thanks for your website though, useful resource :)
Really unorganised, and not properly working. Sad, but i just re-started cpp. Don't flame me hard.

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
#include <iostream>
// #include <classes.h>

using namespace std;

char beszo[5];
char inletter;
int elet = 0;

void loop();

int main()
{
	cout << "Welcome to hangman!\n\n"; // és a kurva anyád:DDdd
	cout << "I have thought of a word!\nEnter a letter: "; //ami nem mellesleg a "number" szó
	beszo[0] = 'n';
	beszo[1] = 'u';
	beszo[2] = 'm';
	beszo[3] = 'b';
	beszo[4] = 'e';
	beszo[5] = 'r';

	
	if (elet =! 7) 
		loop();
	else
		cout << "No more lives left, program quiting...";

	system("PAUSE");
	return 0;
}

void loop()
{
	cin >> inletter;
	switch (inletter) {
	case 'n':
		cout << "You guessed one letter right";
		break;
	case 'u':
		cout << "You guessed one letter right";
		break;
	case 'm':
		cout << "You guessed one letter right";
		break;
	case 'b':
		cout << "You guessed one letter right";
		break;
	case 'e':
		cout << "You guessed one letter right";
		break;
	case 'r':
		cout << "You guessed one letter right";
		break;
	default:
		cout << "No letter in the word like this...";
		elet++;
                break;
	}
}
Last edited on
Instead of hardcoding the word in two places like that you should pass it to "loop()" as a string and use the ".find()" member function from the std::string class to determine if the user guessed a letter in the word. Also the function "loop()" should return a boolean value indicating if the players guess was valid of not.
As Computergeek suggested, use strings instead. I used strings while making mine, but I never used the .find() member, I used a loop for the check of a letter.

I'll go through my code now and comment it, then I'll upload it to the site above.
I'd appreciate it. I should read your code, and than try to make mine from head.
http://sites.google.com/site/davevisone/home/cplusplus-programming-download

Have fun! It jumps around a bit( function-to-function ), but I like to make a function for almost everything! ahaha

If you have trouble following it, while reading the code, stop where you are and jump to the function which is being called, rather than skipping it.

All the source code .cpp files are in the .zip, as well as the compiled Hangman.exe.
Topic archived. No new replies allowed.