Question
C++ Question Rating all helpful solution thumbs up! Please compile code first. Without using vectors: Example Output: My code so far(compiles without required snippet): #include
C++ Question
Rating all helpful solution thumbs up! Please compile code first.
Without using vectors:
Example Output:
My code so far(compiles without required snippet):
#include
class roman { public: roman(); //sets valid to false
private: string roman_numeral; //contains a roman numeral or the null string bool valid; //if roman numeral stored within is valid void set_roman(string); //if string contains roman numerals, roman_numeral equal to its value and set valid true string get_roman() const; //returns roman_numeral int get_arabic(); //if valid is true,roman_numeral to arabic and return it, otherwise 0 };
roman::roman() //Constructor { valid = false; }
void roman::set_roman(string text) { //if string contains only roman numeral characters //set roman_numeral = to its value and set valid true }
string roman::get_roman() const { }
int roman::get_arabic() { }
void readfile();
int main(int argc, char **argv) { if (argc
return 0; }
void readfile() {
}
You are to write a program utilizing a class called roman which will be used to store a Roman numeral and convert it to Arabic numerals. The class should contain only the following private member variables roman_numeral: a string that contains a Roman numeral or the null string valid: a bool that represents if the Roman numeral stored within is valid e * The class should contain only the following public member functions: The default constructor which sets valid to false There is no need to set the value for roman_numeral because the default string constructor creates an empty string o void set_roman (string): if the string parameter contains only characters used in Roman numerals (capital M, D, C, L, X, V, and I) it should set roman_numeral equal to the string value and set valid equal to true string get roman const: returns roman numeral int getarabic ( ) : if valid is true, does the conversion of romannumeral to Arabic numerals and returns it. otherwise returns 0 e - - A data file will contain an unknown number of lines to be read and processed as described below. With respect to the file fafiename is provided and does exist then it is guaranteed to contain atteastone tine- . Each line in the file will contain one potential Roman numeral to be processed The file will contain no blank lines but will end with a newline If a line in the file contains only characters used in Roman numerals then it is guaranteed to be a Roman numeral conforming to standards (e.g. nothing like WVVM or MVWVV) . After your argument and file verification your main body should contain this exact code snippet: string line; while (getline (infile, line)) roman ri r.set roman (line); coutStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started