أرجو مساعدتي في هذا البرنامج فقد طرحتها كموضوع منفرررد ولكننن ارجوو مساعدتي فيه في اقربب وققققت ممكن للضرروره
write a programme that converts a number entered in roman numerals to decimal. your programme should consist class .say roman type.an object of the type roman type should do the following:
1-store the number as a roman numeral
2-convert and stor the number into decimal
3-print the number as a roman numeral or decimal number as requested by the user
the decimal valus of the roman numerals are
M 1000
D 500
C 100
L 50
X 10
V 5
1 I
ارجو الرد علي في اقرب وقتتتت ممكن.... البرنامج غير مفهوم ارجووو شرح لي طريقة حل
and this is a try but it does't work correctly
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
class Student
{
public:
Student();
void setAll(string);
void getAll(string&);
void print();
void computeType();
private:
string Name;
};
string name;
long int y[7];
int i,j=0;
Student:: Student()
{
Name = ""; // BECAUSE ITS A STRING
}
void Student:: setAll(string name)
{
cout<<"Please enter your name" <<endl;
cin>>name;
Name = name;
}
void Student:: getAll(string& name)
{
name = Name;
}
void Student:: computeType()
{
for(i=0;i!='\0';i++)
{
if(name=='M')
y[j]=1000;
else
if(name=='D')
y[j]=500;
else
if(name=='C')
y[j]=100;
else
if(name=='L')
y[j]=50;
else
if(name=='X')
y[j]=10;
else
if(name=='V')
y[j]=5;
else
if(name=='I')
y[j]=1;
}
j++;
}
void Student:: print()
{
getAll(name);
cout<<"the student name is:"<<name<<endl;
for(j=0;j<7;j++)
cout<<y[j];
computeType();
}
int main ()
{
Student std1;
std1.setAll(name);
std1.getAll(name);
std1.print();
return 0;
}