troubleshooting Question


Avatar of jandhb
jandhb asked on
C++Editors IDEs
13 Comments1 Solution322 ViewsLast Modified:
First, I'm new at using classes and have what I believe to be a farely simple question here. I appreciate the help in advance.
I have a console application that is using a class called family. Here it is so far...
class family
      float firstName;
      float getName(float);
I also have .h file that has a function in it called getName. Here it is so far...
#include <iostream.h>
#include "family.h"

float family::getName (float d)
      firstName = d;
      return firstName;
I have another .cpp file....
#include <iostream.h>
#include "family.h"

void main (void)
      family member;
      float dad;
      cout<<"Who is the dad?";
      cin >> dad;
      cout<<"His child is then " <<member.getName(dad);

where I would like to ask for the father's name and return the children of that family based upon the input. I know I will have to add some to the function, but can you help with that if you have a minute. And also, right now when I enter say, "M" for the dad it returns some random number like -1.07374e+008.

Can you help me with the function and what is needed to be able to retun char data instead of numeric?

Again, thank you.

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 13 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros