QUOTE(gabehabe @ 20 May, 2008 - 03:08 PM)

QUOTE
I am new on this site. But this forums hepled me a lot in my previous course
How come you've only got one post then?

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.
Please post like this:

Thank you for helping us helping you.
hi..thanks for ur reply..i dont know that i have to attach code with my previous message....i have done some work on this code..what i did ,i have made 3 free functions...but could not able to print the generation's result in outputfile...plz take a look to my code and try to help me...
QUOTE(sid2008 @ 21 May, 2008 - 09:15 AM)

QUOTE(gabehabe @ 20 May, 2008 - 03:08 PM)

QUOTE
I am new on this site. But this forums hepled me a lot in my previous course
How come you've only got one post then?

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.
Please post like this:

Thank you for helping us helping you.
hi..thanks for ur reply..i dont know that i have to attach code with my previous message....i have done some work on this code..what i did ,i have made 3 free functions...but could not able to print the generation's result in outputfile...plz take a look to my code and try to help me...
here is the code...
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
using namespace std;
const int ARRAY=10;
void load_init(char [ARRAY] [ARRAY]);
void print_grid (char [ARRAY] [ARRAY]);
void copy_array(char [ARRAY] [ARRAY], char [ARRAY][ARRAY]);
int main()
{
char life[ARRAY] [ARRAY];
int i;
unsigned int seed;
int num_of_gen;
ofstream outfile;
outfile.open("conway.txt");
cout<<"Please enter a number to initiate the grid(positive integers): ";
cin>>seed;
cout<<"Please enter the number of generations you would like to see.\n";
cout<<"(use more than 10 to make it interesting): ";
cin>>num_of_gen;
srand(seed);
load_init(life);
for(i=1; i<= num_of_gen; i++)
{
outfile<<"\nGeneration: "<< i <<"\n\n";
print_grid(life);
}
outfile.close();
return 0;
}
void load_init(char INITIAL[ARRAY] [ARRAY])
{
int y,x,z;
for(y=0; y<ARRAY;y++)
{
for(x=0;x<ARRAY;x++)
{
z=(int) (10.0*rand()/RAND_MAX+1.0);
if(z < 5)
INITIAL[y] [x]=' ';
else
INITIAL[y] [x]='*';
}
}
}
void print_grid(char INITIAL[ARRAY] [ARRAY])
{
int y,x;
ofstream outfile;
outfile.open("conway.txt");
outfile<<" ";
for(x=0;x<ARRAY;x++)
for(y=0; y<ARRAY;y++)
{
for(x=0;x<ARRAY;x++)
{
outfile<<INITIAL[y][x];
}
outfile<<"\n";
}
//outfile.close();
}
void copy_array(char INITIAL[ARRAY][ARRAY], char COPY[ARRAY][ARRAY])
{
int y,x;
for(y=0;y<ARRAY;y++)
for(x=0;x<ARRAY;x++)
COPY[y][x]=INITIAL[y][x];
}