Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

little char problem

Posted on 1998-02-16
3
Medium Priority
?
167 Views
Last Modified: 2010-04-10
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
Comment
Question by:dpms
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
q2guo earned 80 total points
ID: 1182363
try this

void CRational::ddy ()
{  
          char Fc[] = {'0'+m_Numerator, '/', '0'+m_Denominator};
          printf("%s",Fc);
          return;
}
0
 
LVL 3

Expert Comment

by:q2guo
ID: 1182364
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
 

Author Comment

by:dpms
ID: 1182365
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question