Solved

little char problem

Posted on 1998-02-16
3
165 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 20 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

734 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