I'm getting three compiler errors from VC++. It's saying that I have an undeclared identifier when I call the stuff function, and at my stuff function it says "redefinition; different type modifiers". I have no idea what's wrong with it, especially the first one. Someone please give me some light as to my problems.
Code:#include <iostream> #include <stdio.h> using namespace std; int girls, boys; int main(void) { int c1,input; bool blah; cout << "Number of iterations?" << endl; cin>>input; for(c1=0;c1<input;c1++) { blah=stuff(); } cout<<endl<<endl<<"Number of Girls are: "<<girls<<endl<<"Number of Boys are: "; cout<<boys<<endl<<endl<<"Probability of girls is: "<<(girls/(girls+boys)); return 0; } bool stuff(void) { int c2,num1; for(c2=0;c2<4;c2++) { num1=rand()%2; if(num1==0) { girls++; return true; } else { boys++; } } return false; }



LinkBack URL
About LinkBacks


