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.
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!!
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?
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.
#include <iostream>
// #include <classes.h>
usingnamespace 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;
}
}
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.