Forum: C Nov 11th, 2007 |
| Replies: 2 Views: 1,536 Hey, I've written a tic tac toe program.
Computer makes some random moves, but i want it to be smarter and make some intellegent moves.
any idea how to approach it?
here's the code i've written.... |
Forum: C Oct 21st, 2007 |
| Replies: 12 Views: 1,966 my latest attempt:
if (scanf ("%i", &val) != 1)
{
printf ( "Invalid input! Please enter your value again:\n" );
getchar();
scanf("%i", &val);... |
Forum: C Oct 21st, 2007 |
| Replies: 12 Views: 1,966 why can i not use scanf?
I don't know how mygeti works.
and another thing.
when i the value is not in range, I get the error message, but i wanted it to stop after the error.
I used a break... |
Forum: C Oct 21st, 2007 |
| Replies: 12 Views: 1,966 hey,
thanks for your help. Ireally appreciate it.
it's working, but partly!
when a non-integer value is entered, it gives me the error messege .
but doesn't let me to enter again, and continues... |
Forum: C Oct 21st, 2007 |
| Replies: 12 Views: 1,966 here's the whole testdrive which I'm working on:
#include <stdio.h>
#include<stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include<ctype.h>
// Constants for TTT... |
Forum: C Oct 21st, 2007 |
| Replies: 12 Views: 1,966 hey!
I'm working on a program that part of it asks for an integer input.
then if the value entered is not an integer, it should print an error message. If not, then the rest
of program (which I've... |
Forum: C Oct 1st, 2007 |
| Replies: 4 Views: 7,416 |
Forum: C Sep 30th, 2007 |
| Replies: 4 Views: 7,416 thanks for the explanation.
now i understand what it means.
but what about " variable != '\n' " in an if command?
what does it mean " if variable is not '/n'?
and is there any other way of... |
Forum: C Sep 30th, 2007 |
| Replies: 4 Views: 7,416 what is a newline character and what does it do?
for example, what does " variable != '\n' " mean?
And is there any other way to write" if (variable != '0' && variable != '1' && variabel != '\n')... |
Forum: C Sep 29th, 2007 |
| Replies: 8 Views: 978 putting if statement in the while loop didn't seem to work. at least the way i did it .
Could you please show on the codes what you meant.
how do you seperate the input form the conversion?
the... |
Forum: C Sep 29th, 2007 |
| Replies: 8 Views: 978 but how?
I read the very first input.
but i'm stuck when it comes to the the second input and third and ....
it would have been great had you explained a bit more.
thanks though.
cheers |
Forum: C Sep 29th, 2007 |
| Replies: 8 Views: 978 here's the best i came up with.
but sitll, it doesn't account for invalid numbers which start with 0 or 1 ( ie 123)!
thanks in advance.
#include <stdlib.h>
#include <stdio.h>
int main ()
{... |
Forum: C Sep 29th, 2007 |
| Replies: 8 Views: 978 hey there;
i wanted to write a program to convert binary to decimal.
i did that using the " character approach".
it works just fine.
then i decided to enhance the program by adding an error... |