Ugh, I knew it was something obvious...Thanks so much!
Type: Posts; User: Kespoosh
Ugh, I knew it was something obvious...Thanks so much!
Alright, I read "Lesson One: An Introduction to Windows Programming," and copied and pasted the code (see below) into my compiler (VC++ 6.0), compiled fine but when built I get the following errors:...
Will this fix the problem? Or is it just another one of the things I screwed up on? :P
I'm trying! It won't play unless an if statement is fulfilled.
Oh yeah....sorry!
This is my code:
#include <iostream.h>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
char playagain='y';
char number;
Uh...what?
I think I know what's wrong. For(i=i+'0';i<10;i++)...i++ tries to add (int)1 to (char)i, doesn't it?
#include <iostream.h>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
char playagain='y';
char number;
char array[10];
char i='1';
char compnumber;
Alright, I'll do that, thanks. Can you explain how srand(time(NULL)) works? It would help greatly in the future if I understood that.
I said it's incomplete....It checks to see if it can win or stop the player from winning first (not completed yet), and if it can't it uses a random number to determine which spot to put an O in, and...
Alright, well, that part's working, now. Please see my other thread if you're interested in helping me with my other problem.
It worked before, exactly like that...
Can you explain this a little more? I'm very new to C++.
Here's my code for a tic-tac-toe game. It's incomplete, but almost done.
#include <iostream.h>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
char playagain='y';
char number;
I was hoping there was a faster way to do it, but thanks.
My sample, stupid fake code:
#include <iostream.h>
int x;
int main(void)
{
cout << "Option 1, 2 or 3?"
Yeah, I tried that, but number as a char didn't accept input properly. Anyway, I found somewhere on this board that char i='4', i=i-'0' makes i integer 4.
I don't claim to be any good at C++, but I believe that you have to have an array, not a char. I think a char will only store one keystroke, whereas an array can store many characters. I think.
I know, but if i=0, that elimintes some much easier coding later on
I see. So, how can I make this work? I don't want to use multiple variables for each space...Can I convert a char into an int temporarily?
I'm trying to make a simple tic-tac-toe program. In the example below, it's incomplete, only I finished it enough to run it and check for errors.
#include <iostream.h>
#include <stdio.h>...
Thanks!
Ok, I just thought a switch would be easier than many, many, many IF statements. What would be faster? I was thinking, if I stored a bunch of variables in an array, is there any way to compare the...
To check to see if a variable equals the input, but isn't already assigned to something else.
Can a Switch/Case statement have AND, NOT and OR in it? As in:
switch (a)
case 1 && c!=4:
etc.