Here is a simple code which is supposed to convert a double to an ascii string and then an int to an ascii string by making use of an overloaded function, but when I compile the code I get a whole lots of errors.. and I can't understand why...
Code:
#include<iostream>
#include<conio.h>
#include<ctype.h>
#define cout std::cout
#define endl std::endl
char *toascii(int i);
char *toascii(double f);
void main ()
{
char *s;
double a = 12.3;
s = toascii(a);
cout<<"float = "<<s;
int i=55;
s = toascii(i);
cout<<"int = "<<s;
}
char *toascii(double f)
{
char *s[5];
gcvt(f,5,s);
return s;
}
char *toascii(int i)
{
char *s[5];
itoa(i,s,2);
return s;
}