hello, i got a error, declaration of string shadows a parameter...mind help me with it
#include <fstream>
#include <string>
using namespace std;
int numToRom(string&,string&,string&);
int main()
{
string data;
string result;
string romNum;
cout<<"Please enter a number"<<endl;
cin >> data;
numToRom(data, result, romNum);
cout<<"Output : "<<result<<endl;
}
int numToRom(string& data, string& result, string& romNum)
{
string romNum[] =
{ "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" };
int num;
num = atoi(data.c_str());
for(int i = 0; i<data.length(); i++)
{
if(num <= 0 || !isdigit(data[i]))
{
result = "Don't Type zero or alphabet";
}
else if(num >= data[i])
{
num -= data[i];
result.append(romNum[i]);
}
}
}
thanks a million