Friday, July 31, 2009

Help... in Turbo C?

can anyone help me how to create a program that will covert roman numerals to arabic.. please give me the complete source code... thanks... please dont suggest me to study it first..

Help... in Turbo C?
DECIMAL TO ROMAN


..hope you can figure out the reverse


check these sites ..


http://cboard.cprogramming.com/archive/i...


http://www.thescripts.com/forum/thread59...


http://www.koders.com/kv.aspx?fid=38CE0D...


#include %26lt;stdio.h%26gt;


#include %26lt;string.h%26gt;





/*


Known Roman numerals are:


I=1, V=5, X=10, L=50, C=100, D=500, M=1000


Anything greater is represented by appending '~'s.


Each '~' represents multiplication by 1000.





The length of the input is unlimited.


*/





static const char *rom[] = {


"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX",


"", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC",


"", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"


};





int main(int argc, char **argv)


{


size_t i, j, k, len, m, numdig;


const char *p;





if(argc != 2)


{


fprintf(stderr, "Usage requires one argument: "


"a decimal number to convert.\n");


return 0;


}


numdig = strlen(argv[1]);


for(i = 0; i %26lt; numdig; i++)


{


j = numdig - i - 1; /* reverse index */





if(argv[1][i] %26lt; '0' || argv[1][i] '9')


{


putchar('\n');


fprintf(stderr, "Invalid digit: %c\n", argv[1][i]);


return 0;


}





/* Add your algorithm here. How to determine


which element of the 'rom' array to


output?





It's all about mathematics. Think about the


values of:





argv[1][i] - '0'





j % 3





j % 3 * 10





j / 3


*/





}


putchar('\n');


return 0;


}
Reply:By all means no; don't study programming or c language as you are having enough trouble just with English :)





"please don't suggest that I study it first"


"please don't suggest, I study it first"


"please don't make the suggestion for me to study it first"





I understand that you may wish to see an answer so that you can learn how to write c and how to solve a simple problem. I would write it for you but I don't have half an hour to spare and you haven't said why, but you did say please and that counts for a lot.





If you are lucky some sod will cut and paste an answer from someone else's website as if they did it themselves.
Reply:If it is your assignment, hire a freelancer from websites like http://getafreelnacer.com/
Reply:if u dont wanna think about it, search for a freelancer


No comments:

Post a Comment