I have this following code and Error invalid conversion from 'char' to 'const char*' occurs.
I have created a header file and the other one is the main file(source file.)
header file is:
using namespace std;
class romanType
{
public:
void romanNum();
void decimalNum();
void print();
romanType(string = '*', int = 0);
~romanType();
private:
string roman;
int decimal;
};
void romanType::romanNum()
{
cout<<"Please enter the number in Roman: ";
cin>>roman;
}
void romanType::print()
{
short i;
cout<<"Please enter 0 to print Roman number"
<<" or 1 to print corresponding decimal number.";
cin>>i;
if(i)
cout<<"Decimal number is: "<<decimal<<endl;
else if(!i)
cout<<"Roman number is: "<<roman<<endl;
else
{
cout<<"Invalid entry please renter the number."<<endl;
print();
}
}
romanType::romanType(string a, int b)
{
roman = '*';
decimal = 0;
}
// and main file is
#include<iostream>
#include"romanType.h"
using namespace std;
int main()
{
romanType number; //This line gives error.
number.romanNum();
number.decimalNum();
number.print();
system("pause");
}
//when I run this prgram the error occurs Invalid conversion from 'char' to 'const char*'. Please help main