I have a code written out with zero errors but i know my main() function is completely wrong and after i build the solution i compile it and nothing happens!! Not even cout statements please help.
// 2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
using namespace std;
class romanNumerals {
// handles arithmetic operations on Roman Numerals
// conditions maintained in class:
// 0 < num < 3999
public:
void const returnRoman (char roman[]); // returns a roman numeral
void setArabic (int number); // accepts an integer
void setRoman (char* roman); // accepts a roman numeral
bool isError (); // returns true if the most recent operation has caused an error.
private:
int num,M,D,C,L,X,V,I;// the internal representation of the roman numeral
char roman; // the actual roman numeral is not maintained
}; // class romanNumerals
int main()
{
char roman;
int menu=0,output_number=0;
int number =0;
cout << " press 1 to enter arabic number \n press 2 to enter roman numeral " << endl;
cin >> menu;
if(menu==1)
{
number;
output_number = number;
}
else if(menu==2)
{
roman;
output_number = roman;//actually converted into arabic number
}
//need to get output_number value into returnRoman(char roman[]);
roman;//
return 0;
// */
}//end of main
void returnRoman(char roman[])
{
int num;
//takes num (10) and converts it to roman (x)
while (num >=1000)
{
cout << "M" << endl;
num-=1000;
}
while (num >=900 && num<1000)
{
cout << "CM" << endl;
num-=900;
}
while (num >=800 && num<900)
{
cout << "DCCC" << endl;
num-=800;
}
while (num >=700 && num<800)
{
cout << "DCC" << endl;
num-=700;
}
while (num >=600 && num<700)
{
cout << "DC" << endl;
num-=600;
}
while (num >=500 && num<600)
{
cout << "D" << endl;
num-=500;
}
while (num >=400 && num<500)
{
cout << "CD" << endl;
num-=400;
}
while (num >=300 && num<400)
{
cout << "CCC" << endl;
num-=300;
}
while (num >=200 && num<300)
{
cout << "CC" << endl;
num-=200;
}
while (num >=100 && num<200)
{
cout << "C" << endl;
num-=100;
}
while (num >=90 && num<100)
{
cout << "XC" << endl;
num-=90;
}
while (num >=80 && num<90)
{
cout << "LXXX" << endl;
num-=80;
}
while (num >=70 && num<80)
{
cout << "LXX" << endl;
num-=70;
}
while (num >=60 && num<70)
{
cout << "LX" << endl;
num-=60;
}
while (num >=50 && num<60)
{
cout << "L" << endl;
num-=50;
}
while (num >=40 && num<50)
{
cout << "XL" << endl;
num-=40;
}
while (num >=30 && num<40)
{
cout << "XXX" << endl;
num-=30;
}
while (num >=20 && num<30)
{
cout << "XX" << endl;
num-=20;
}
while (num >=10 && num<20)
{
cout << "X" << endl;
num-=10;
}
while (num >=9 && num<10)
{
cout << "IX" << endl;
num-=9;
}
while (num >=8 && num<9)
{
cout << "VIII" << endl;
num-=8;
}
while (num >=7 && num<8)
{
cout << "VII" << endl;
num-=7;
}
while (num >=6 && num<7)
{
cout << "VI" << endl;
num-=6;
}
while (num >=5 && num<6)
{
cout << "V" << endl;
num-=5;
}
while (num >=4 && num<5)
{
cout << "IV" << endl;
num-=4;
}
while (num >=3 && num<4)
{
cout << "III" << endl;
num-=3;
}
while (num >=2 && num<3)
{
cout << "II" << endl;
num-=2;
}
while (num >=1 )
{
cout << "I" << endl;
num-=1;
}
}
void setArabic (int number)// takes arabic number
{
int arabic_number;
cout << " Enter an arabic number between 1 and 3999 " << endl;
cin >> arabic_number;
if(arabic_number<1 || arabic_number >3999)
cout << " Error number out of range " << endl;
number = arabic_number;
}
void setRoman (char* roman)// takes in roman numbers
{
int n=0;
int num =0;
cout << " Enter the Roman numeral atleast I and less than MMMM " << endl;
cin >> roman;
if (roman[n] == 'M')
{
n++;
num +=1000;
}
else if (roman[n]== 'C' && roman[n+1]=='M')
num+=900;
else if (roman[n]== 'D' && roman[n+1+1+1]=='C')
num+=800;
else if (roman[n]== 'D' && roman[n+1+1]=='C')
num+=700;
else if (roman[n]== 'D' && roman[n+1]=='C')
num+=600;
else if (roman[n]== 'D')
num+=500;
else if (roman[n]== 'C' && roman[n+1]=='D')
num+=400;
else if (roman[n]== 'C' && roman[n+1+1]=='C')
num+=300;
else if (roman[n]== 'C' && roman[n+1]=='C')
num+=200;
else if (roman[n]== 'C')
num+=100;
else if (roman[n]== 'X' && roman[n+1]=='C')
num+=90;
else if (roman[n]== 'L' && roman[n+1+1+1]=='X')
num+=80;
else if (roman[n]== 'L' && roman[n+1+1]=='X')
num+=70;
else if (roman[n]== 'L' && roman[n+1]=='X')
num+=60;
else if (roman[n]== 'L')
num+=50;
else if (roman[n]== 'X' && roman[n+1]=='L')
num+=40;
else if (roman[n]== 'X' && roman[n+1+1]=='X')
num+=30;
else if (roman[n]== 'X' && roman[n+1]=='X')
num+=20;
else if (roman[n]== 'X')
num+=10;
else if (roman[n]== 'I' && roman[n+1]=='X')
num+=9;
else if (roman[n]== 'V' && roman[n+1+1+1]=='I')
num+=8;
else if (roman[n]== 'V' && roman[n+1+1]=='I')
num+=7;
else if (roman[n]== 'V' && roman[n+1]=='I')
num+=6;
else if (roman[n]== 'V')
num+=5;
else if (roman[n]== 'I' && roman[n+1]=='V')
num+=4;
else if (roman[n]== 'I' && roman[n+1+1]=='I')
num+=3;
else if (roman[n]== 'I' && roman[n+1]=='I')
num+=2;
else if (roman[n]== 'I')
num+=1;
cout << num << endl; //now actually converted to arabic
}