I am new to C++ and am currently working on a project that wants me to turn a Roman Numeral into a Hindu-Arabic number (our normal number system). I'm currently writing a class RomanNumeralType which needs to store a roman numeral type string. When I try to run the code below I get error code C3646: unknown override specifier and also error codes C4430 and C2061 which both address string (in bold) not being a valid identifier. It was my impression that #include fixed this however I am unsure why it is not working. I currently do not have a function that actually converts the numeral to a number but I want to fix this problem first. How do I get the string data type to work in my class?
Here is a minimally reproduced example of my code
//main
#include <iostream>
#include <iomanip>
#include "Header2.h"
#include <string>
using namespace std;
int main() {
string ans;
cout << "Please enter a string of Roman Numerals (M,D,C,L,X,V,I): " << endl;
cin >> ans;
}
RomanNumeralType r1(ans);
cout << "Your original Roman Numeral was: " << r1.getNumeral() << endl;
cout << "Your Roman Numeral as a integer is: " << r1.getNumber(r1.getNumeral()) << endl;
return 0;
}
//Header2.h
#ifndef HEADER2
#define HEADER2
#include <string>
class RomanNumeralType {
public:
**string** romanNumeral;
RomanNumeralType(**string** x)
{romanNumeral = x;}
**string** getNumeral()
{return romanNumeral;}
}