Thread: Class Array
View Single Post
Old 05-09-2004, 10:47 PM   #3 (permalink)
joe_bruin
LOAD "*",8,1
 
Join Date: Feb 2003
Location: la.ca.us
Posts: 254
joe_bruin is on a distinguished road
you're searching the wrong planets. A is not initialized in this function.

Code:
void Planet::find()
{
Planet A[5];
char find[100];
cout<<"Find which planet?"<<endl;
cin>>find;
//cout<<"Find is "<<find<<endl;
//bool found=false;
for(int i=0; i<=5 ; i++)
{
if (strcmp(find, A[i].n)==0)
{
//found=true;
cout<<"radius"<<A[i].r;
}
else
{
cout<<"Planet not found"<<endl;
}
}
}
joe_bruin is offline   Reply With Quote