hey all,
I'm working on a geneolgoical program where we are coding relatives based on gender and generation, where at the command prompt f for female or m for male is ntered, after which, one has the option to continue (i.e. for the next generation). At the end, the entries appear as a number.
For example, a man's mother's mother would be 100.
Here's what I have so far:
#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
main()
{
int N=0;
int gen [N];
char x;
char m;
char f;
top:
N=N+1;
cout<<"\nmale or female? m or f\n";
cin>>x;
if (x=='m'){
char
gen [N]=1;
cin
}
else {
gen[N]=0;
}
cout<<"Next generation? y or n ";
char a;
cin>>a;
char y;
char n;
if (a=='y'){
goto top;
}
else
cout<<"\n";
for (int i=0; i<N; ++i)
cout<<gen;
}
the problem that I'm having is that it will indeed give a string of numbers, the length of which is correct, but it merely repeats the LAST entry.
For example, if I input m, m, f, f, I should get 1100, but instead
I get 0000.
I'm sorry if I haven't explained it very clearly, but I would appreicate any help.
777