program 4 - /Item / /Pasting this table in / /your writeup...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
//Item Points Actual // Possible Points P //Pasting this table in 1 //your writeup / //Your name 1 //Description 1 //Function Comments 7 //(parameters, pre/post //conditions, descriptions) / //Variable comments 2 //Use of functions 4 //Roman to English 10 1 //English to Roman 10 1 //Handles Multiple 1 //Expressions / //3 test cases 3 /******************************************************************************/ / //Tom Nanke //CIS 150-001 //11-20-07 //Program 4 //This is a roman number calculator program. It can add, subtract, or multiply //roman numbers. The user inputs a roman number, followed by the operator that //he/she wants to use, followed by another roman number. The program then reads //that expression, converting the roman numbers into integer numbers, does the //math of the operation, and then converts the answer back into a roman number, //which is what is output onto the screen. / #include <iostream> # using namespace std; u int romanToDecimal(int &number); //Function prototype void decimalToRoman(); //Function prototype / char roman[8]={'I','V','X','L','C','D','M','0'}; //array of possible characters the user can enter that will be needed / int main() { int number; //Initialization of the the variable number, which is the //integer number that the romanToDecimal function will return. int index=0; //Initialization of the variable index, which will represent //the location of the character in the roman array. cout<<"Enter a roman expression. Enter the number 0 at any point"<<endl;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
cout<<" to exit the program: "; cin>>roman; c romanToDecimal(number); //Function call cout<<"The answer is: "; decimalToRoman(); //Function call cout<<endl; c while(roman[index]!='0') //Loop that executes until the user enters 0. { cout<<"Enter a roman expression: ";
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

program 4 - /Item / /Pasting this table in / /your writeup...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online