Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 168
  • Last Modified:

little char problem

Why does my function (in VC5) give "cannot convert from 'char *' to 'char'" as an error??

void CRational::ddy ()
{
char Fc [] = {m_Numerator + "/" + m_Denominator};
printf("%s",Fc);
return;
}
0
dpms
Asked:
dpms
  • 2
1 Solution
 
q2guoCommented:
try this

void CRational::ddy ()
{  
          char Fc[] = {'0'+m_Numerator, '/', '0'+m_Denominator};
          printf("%s",Fc);
          return;
}
0
 
q2guoCommented:
since you are using VC5 why don't you try this

void CRational::ddy()
{
      String a(m_Numerator);
      String c('/');
      String b(m_Denominator);
      String Fc = a+c+b;

      cout << Fc <<endl;
}
0
 
dpmsAuthor Commented:
Ohhhhh! I knew I was doing something really stupid. Couldn't see the forest for the trees, I guess. That's you guys!!!!!
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now