Hey guys, ya it's been really a while :D
I'v just got a new Program am supposed to make, It is a Game Called "The Game of Life".
Googled it, but I have absolutely NO Idea how it works ..... It'd be great if someone could explain it to me please? :D.
BTW, like... 2 days ago, I wanted to make a Program that reads the PC's time and Date and Prints them on the screen, Googled for such a function for 2 Hours, came up with Nada. Any Ideas?
Best Regards,
Beeko.
7 replies to this topic
#1
Posted 02 October 2010 - 10:29 AM
|
|
|
#2
Posted 02 October 2010 - 10:53 AM
@1 http://en.wikipedia....e_of_Life#Rules (4 rules)
@2:
@2:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
struct tm *current;
time_t now;
time(&now);
current = localtime(&now);
printf("the time is %i:%i:%i\n", current->tm_hour, current->tm_min, current->tm_sec);
exit(EXIT_SUCCESS);
}
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#3
Posted 03 October 2010 - 01:15 AM
Sometimes words ain't enough to express something. That's why computer scientists use double words.
#4
Posted 03 October 2010 - 07:55 AM
1- That is a different game of life,I meant The game of life, invented by the mathematician John H. Conway.
2-
2-
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
struct tm *current; [COLOR="red"]//why did u make a struct? And whats with the Pointer? And isnt Structs supposed to be defined above the main?[/COLOR]
time_t now;
time(&now);
current = localtime(&now);
printf("the time is %i:%i:%i\n", current->tm_hour, current->tm_min, current->tm_sec); [COLOR="red"]//wth is this line? :D[/COLOR]
exit(EXIT_SUCCESS); [COLOR="red"]//same?[/COLOR]
}
#5
Posted 03 October 2010 - 09:25 AM
struct tm *current;In C, or some versions of it, you have to type struct infront of it, and sometimes you may see something like this:
typedef struct myStruct myStruct;This just makes it easier - you don't have to type struct anymore.
A conclusion is where you got tired of thinking.
#define class struct // All is public.
#6
Posted 03 October 2010 - 09:28 AM
I think I forgot to mention am working on C++? :D
#7
Posted 03 October 2010 - 05:13 PM
I did link to Conway's game and the rules.
ctime in C++ uses C's time library (time.h), C++ is based on C.
Beeko said:
I think I forgot to mention am working on C++? :D
ctime in C++ uses C's time library (time.h), C++ is based on C.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#8
Posted 03 October 2010 - 09:48 PM
Yes i know that but the code he Gave me doesnt make any sense any more xD
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









