Sunday, August 2, 2009

C++ question?

this is what ive got too.


i need to be able to put a number in 1 through ten and then have the program convert it to a roman numeral.





direct me with code the right way. thanks





#include %26lt;cstdlib%26gt;


#include %26lt;iostream%26gt;





using namespace std;





int main(int argc, char *argv[])


{


cout %26lt;%26lt; " *This program was written by Jacob A. DePratti*" %26lt;%26lt; endl;


cout %26lt;%26lt; "" %26lt;%26lt; endl;











cout %26lt;%26lt; "Please Enter A Number 1 Through Ten" %26lt;%26lt; %26lt;%26lt; endl;


cout %26lt;%26lt; "The Roman Numeral Of This Number Is: " %26lt;%26lt; %26lt;%26lt; endl;


cout %26lt;%26lt; "" %26lt;%26lt; endl;





system("PAUSE");


return EXIT_SUCCESS;


}

C++ question?
Use SWITCH:





char s[10];


switch(num)


{


case 1: strcpy(s,"I");


case 2: strcpy(s,"II");


case 3:


.....


case 10: strcpy(s, "X")


}





cout %26lt;%26lt; s%26lt;%26lt;endl;


No comments:

Post a Comment