I'm going to learn C++

I’m sitting here with my seventy-five dollar books, and I’m about to open them, and suck the knowledge right out.

I need/want to learn at the same time as some other fairly competent person.

You know, so I can ask, and awnser questions.

Any takers?

I’m learning, but I’m eons (half a year) ahead of you. Either you catch up, I slow down, or you learn something that I haven’t learned yet =P

I’m like Timaster, except I’m only half an eon ahead of you.

Bring it on. I know some basics and stuff, and in fact, I made a DLL quite a while back. But for the most part, I don’t deal with C++. Also, why did you waste money on books? You could’ve at least headed to www.cplusplus.com and checked out some tutorials first.

I actually bought a book in 2002 called Absolute Beginner’s Guide to Programming. I’d recommend, if you haven’t programmed before (and even if you’ve used GameMaker, I still recommend it to a somewhat lesser extent) because it gives you a basic understanding of how computers work… It’s got chapters about C, C++, Visual Basic, FORTRAN, COBOL, JavaScript, and HTML. I’m sure there are a few others in there, too. Regardless, I recommend this because knowing a little bit of everything can help immensely more than knowing a lot of one thing and none of anything else.

If you want, I’m sure you can get me to scan some pages for you. It’s got pictures and all.

If you could do that, it’d be great. And as for why I own the books…

I talked about C++, and why I wanted to learn it for a while, and my uncle thought I was asking for books. :confused:

I skimmed through the first chapter, and I now know some basic terms, woo.

Lol. I’ll learn C++…half past never. I’m a custom spriter, and that’s all. I dont even know how to rip sprites, or gamemaker. It’s hard enough to keep Redhalberd and Akilade seperate people, so all I do is what I’m good at, Spriting. I dont really even bother with online communities, I just go there to post my sprites.

Anyway, good luck, that stuff doesnt sound easy.

I just finished a tic-tac-toe program, actually. It’s got no AI at this point, but it’s worth a chicking and a checking. Hopefully pasting it won’t murder the formatting too badly.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>

char board[2+1][2+1];

typedef enum {me, you} player;
typedef enum {X, O, none} marker_type;

void random_move(char);
void display();
void initialize();
void play(player, char, char);
bool winner(player, char, char);
void myplay(char);
void yourplay(char);

inline bool freecell(int row, int col)
{ 
	if (board[row][col] == ' ')
 &nbsp;return true;
	else
 &nbsp;return false;
}

int main()
{
	srand((unsigned)time(0));
	char me_marker, you_marker;
	int first_player = 0;
	int rotate;
	int moves;
	char c;
	player who;
	bool win;
	do
	{
 &nbsp;rotate = first_player;
 &nbsp;if (first_player == 0)
 &nbsp;{
 &nbsp;	me_marker = 'X';
 &nbsp;	you_marker = 'O';
 &nbsp;	first_player = 1;
 &nbsp;}
 &nbsp;else
 &nbsp;{
 &nbsp;	me_marker = 'O';
 &nbsp;	you_marker = 'X';
 &nbsp;	first_player = 0;
 &nbsp;}
 &nbsp;printf("Your marker is %c\n\n", you_marker);
 &nbsp;moves = 0;
 &nbsp;win = false;
 &nbsp;initialize();
 &nbsp;do
 &nbsp;{
 &nbsp;	if (rotate == 0)
 &nbsp;	{
 &nbsp; &nbsp;who = me;
 &nbsp; &nbsp;rotate = 1;
 &nbsp;	}
 &nbsp;	else
 &nbsp;	{
 &nbsp; &nbsp;who = you;
 &nbsp; &nbsp;rotate = 0;
 &nbsp;	}
 &nbsp;	if (moves < 9)
 &nbsp;	{
 &nbsp; &nbsp;moves++;
 &nbsp; &nbsp;play(who, me_marker, you_marker);
 &nbsp; &nbsp;display();
 &nbsp; &nbsp;win = winner(who, me_marker, you_marker);
 &nbsp; &nbsp;if (win == true)
 &nbsp; &nbsp;{
 &nbsp; &nbsp;	if (who == me)
 &nbsp; &nbsp; &nbsp;printf("\nYou LOSE!\n");
 &nbsp; &nbsp;	else
 &nbsp; &nbsp; &nbsp;printf("\nYou WIN!\n");
 &nbsp; &nbsp;	moves = 9;
 &nbsp; &nbsp;}
 &nbsp;	}
 &nbsp;}while (moves < 9);
 &nbsp;if (win == false)
 &nbsp;	printf("\nYou TIED!\n");
 &nbsp;printf("\nPlay again(y/n)? ");
 &nbsp;do
 &nbsp;{
 &nbsp;	c = toupper(getchar());
 &nbsp;}while(c != 'Y' && c != 'N');
	}while(c == 'Y');
	return 0;
}

void initialize()
{
	int i, j;

	for (i = 0; i <= 2; i++)
	{
 &nbsp;for (j = 0; j <= 2; j++)
 &nbsp;	board[i][j] = ' ';
	}
}

void display()
{
	printf("\n\t %c | %c | %c\n", board[0][0], board[0][1], board[0][2]);
	printf("\t---+---+---\n");
	printf("\t %c | %c | %c\n", board[1][0], board[1][1], board[1][2]);
	printf("\t---+---+---\n");
	printf("\t %c | %c | %c\n\n", board[2][0], board[2][1], board[2][2]);
}

void play(player who, char me_marker, char you_marker)
{
	if (who == me)
 &nbsp;myplay(me_marker);
	else
 &nbsp;yourplay(you_marker);
}

void myplay(char me_marker)
{
	int i, j, k;
	do
	{
 &nbsp;k = rand() % 9;
 &nbsp;switch (k)
 &nbsp;{
 &nbsp;	case 0: i = 0; j = 0; break;
 &nbsp;	case 1: i = 0; j = 1; break;
 &nbsp;	case 2: i = 0; j = 2; break;
 &nbsp;	case 3: i = 1; j = 0; break;
 &nbsp;	case 4: i = 1; j = 1; break;
 &nbsp;	case 5: i = 1; j = 2; break;
 &nbsp;	case 6: i = 2; j = 0; break;
 &nbsp;	case 7: i = 2; j = 1; break;
 &nbsp;	case 8: i = 2; j = 2; break;
 &nbsp;}
	}while(freecell(i,j) == false);
	board[i][j] = me_marker;
	printf("My move: %d %d\n", i+1, j+1);
}

void yourplay(char you_marker)
{
	int i, j;
	do
	{
 &nbsp;printf("\nYour turn: ");
 &nbsp;scanf("%d %d", &i, &j);
 &nbsp;getchar(); //remove new line
 &nbsp;i--;
 &nbsp;j--;
 &nbsp;if ((i < 0 || i > 2 || j < 0 || j > 2))
 &nbsp;	printf("You must place your marker on the grid.\n");
 &nbsp;else if (freecell(i, j) == true)
 &nbsp;{
 &nbsp;	board[i][j] = you_marker;
 &nbsp;	break;
 &nbsp;}
 &nbsp;else
 &nbsp;	printf("There's already a marker there!\n");
	}while(1);
}

bool winner(player who, char me_marker, char you_marker)
{
	int i, j, t;
	bool win;
	char c;
	if(who == me)
 &nbsp;c = me_marker;
	else
 &nbsp;c = you_marker;

	win = false;

	//diagonals
	if(board[0][0] == c && board[1][1] == c && board[2][2] == c)
 &nbsp;win = true;
	if(board[2][0] == c && board[1][1] == c && board[0][2] == c)
 &nbsp;win = true;
	//horizontals
	for(i = 0; i <= 2; i++)
	{
 &nbsp;t=0;
 &nbsp;for(j = 0; j <= 2; j++)
 &nbsp;{
 &nbsp;	if(board[i][j] == c)
 &nbsp; &nbsp;t++;
 &nbsp;}
 &nbsp;if(t == 3)
 &nbsp;	win = true;
	}
	//verticals
	for(j = 0; j <= 2; j++)
	{
 &nbsp;t=0;
 &nbsp;for(i = 0; i <= 2; i++)
 &nbsp;{
 &nbsp;	if(board[i][j] == c)
 &nbsp; &nbsp;t++;
 &nbsp;}
 &nbsp;if(t == 3)
 &nbsp;	win = true;
	}
	return win;
}

EDIT:
Uh… for semi-better formatting, hit quote, and copy/paste from there.

I’m scared I won’t be able to learn. D:

It’s like learning a new language, except the words are already in your vocabulary with either the exact same meaning or a pretty similar one. You have to learn new punctuation, too! *pt, for example, means “treat pt as a pointer.” That’s the basics, anyway. Advanced programmers need to know about hardware setup, as well as API calls and whatnot.