Friday, July 31, 2009

Another question about c++?

#include %26lt;conio.h%26gt;// needed for getch


#include %26lt;iostream.h%26gt;//needed for cout and cin messages


#include %26lt;iomanip.h%26gt;//





void startup();


void method();


int a2r (int Num);


int main()


{


startup();


a2r (int Num);


method();





getch();


return 0;


}





void startup()


{


cout%26lt;%26lt;""%26lt;%26lt;'\n';


cout%26lt;%26lt;"jan ,2008"%26lt;%26lt;'\n';


cout%26lt;%26lt;"pg-108 ex- pro-6.3"%26lt;%26lt;'\n';


cout%26lt;%26lt;""%26lt;%26lt;'\n';


}








int a2r (int Num)


{


int i, Th, Hu, Ten, Fiv, One;


char Roman1[20];


char Roman2[5];


char Roman3[5];


char Roman4[5];











Th = Num / 1000;


Num = Num - (1000*Th);


Hu = Num/ 100;


Num = Num - (100*Hu);


Ten = Num / 10;


Num = Num - (10*Ten);


Fiv = Num / 5;


Num = Num - (5*Fiv);


One = Num / 1;


Num = Num - (1*One);








for (i=1; i %26lt; Th; i++)


{


cout%26lt;%26lt;"M";


}





for (i=1; i %26lt; Hu; i++)


{


cout%26lt;%26lt;"C";


}





for (i=1; i %26lt; Ten; i++)


{


cout%26lt;%26lt;"X";


}





for (i=1; i %26lt; Fiv; i++)


{


cout%26lt;%26lt;"V";


}


for (i=1; i %26lt;= One; i++)


{


cout%26lt;%26lt;"I";


}














}


void method()


{


char roman[20];


int arabic;





cout%26lt;%26lt;"Arabic to numeral\n";


cout%26lt;%26lt;"Please enter a number between 1 to 4999\n";


cin%26gt;%26gt;arabic;


if (arabic %26lt; 1 || arabic %26gt; 4999)


{


cout%26lt;%26lt;"Please enter a number between 1 to 4999 again";


cin%26gt;%26gt;arabic;


}


a2r(arabic);


}

Another question about c++?
you are making a call to a2r (int Num); function in the main but you are not passing a valid argument. In the brackets put a number or a variable which holds a value.


No comments:

Post a Comment