# Thread: Really niggly, easy problem

1. ## Really niggly, easy problem

Code:
```void Application::DoAddPerson()
{
dMenu.getOption();
string N1;
string Nf;
string A1=" ";
string A2=" ";
string A3=" ";
string PC=" ";
TDate D;
char G;
string T=" ";

cout<<"\nEnter First Name  :";
Get(N1, 10);
cout<<"\nEnter Second Name :";
Get(Nf, 20);
cout<<"\nEnter Address Line 1 :";
Get(A1, 20);
cout<<"\nEnter Address Line 2 :";
Get(A2, 20);
cout<<"\nEnter Address Line 3 :";
Get(A3, 20);
cout<<"\nEnter Postcode :";
Get(PC, 8);
cout<<"\nGet Tel No. :";
Get(T, 8);

Person* newPerson;
newPerson= new Person(N1,Nf,A1,A2,A3,PC,D,G,T);
newPerson->Print();
}

void DoAddStock()
{

eMenu.getOption();
string SN;
string Dn;
double CS;
float US;
float UP;
double MS;

cout<<"\nEnter Stock Number : ";
Get(SN, 8);
cout<<"\nEnter a Description of the Product : ";
Get(Dn, 30);
cout<<"\nEnter Initial Stock Level : ";
Get(CS, 6);
cout<<"\nEnter Unit Size : ";
Get(US, 6);
cout<<"\nEnter Unit Price : ";
Get(UP, 6);
cout<<"\nEnter Minimum Stock Level :";
Get(MS, 6) ;

Stock* newStock;
newStock= new Stock(SN,Dn,CS,US,UP,MS);
newStock->Print();
}```
The Get() function works on DoAddPerson() but on DoAddStock() it will not, it says its a call to an undefined function.

Both of these functions are in the same CPP file.

Any ideas why this is happening.

And i have included <iostream.h>, because it works on the one but not the other.

2. It would probably help if you posted the code for the Get() function as well.

3. Also, are the two function definitions you wrote down listed back to back like that in your program, or are they separated, possibly in different files? And where in relation to the two of these is Get defined?

4. Get() is part of the <iostream.h> header and hence is not my work and the functions are in the same file, back to back.

5. Originally posted by Ryan_P
Get() is part of the <iostream.h> header and hence is not my work and the functions are in the same file, back to back.
I think what you want to use is
Code:
```get();
// NOT
Get();```
I think that capitalizing the G is what's causing your problem.

6. Cheers everyone.

It turns out that it was because i didn't make DoAddStock() part of the Application class.

I am having more trouble now with another problem, but ill start a new thread for that one.....

Popular pages Recent additions