Arguments to Main - Enhanced Command Line Check Writer Write a command-line prog
ID: 3777801 • Letter: A
Question
Arguments to Main - Enhanced Command Line Check Writer Write a command-line program that will write a check. You will need to convert a string representation of a number into its English-word equivalent. Do this by using each digit of the amount string as indexes into string tables (see sample code). The program must run at the command line for any value up to $9999.99. Assume all values will be of the form $X.YY, where X is one to 4 digits. Test your program with several values. For example: Here is much of the code, you will have to extend this to get it working for hundreds and “tentys”. Sample Code: char * numstrings[] = { "", // use numstrings[argv[3][x] - '0'][0] to check this null "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" }; // do thousands if(len > 7) // there must be thousands { // Example: // 01234567 indexes // when argv[3] = "$2475.41" // len = 8 // argv[3][len - 7] = '2' // '2' - '0' = 2 // numstrings[2] = "two" printf(numstrings[argv[3][len - 7] - '0']); printf(" thousand "); } // pass the address of the start of the pennies printf(" and %s/100", &argv[3][len - 2]);
****#include ** just C
NO C++
Program 2) Arguments to Main Enhanced Command Line Check Writer Write a command-line program that will write a check. You will need to convert a string representation of a number into its English-word equivalent. Do this by using each digit of the amount string as indexes into string tables (see sample code). The program must run at the command line for any value up to $9999.99. Assume all values will be of the form $X.YY, where X is one to 4 digits. Test your program with several values. For example C: Windows system32Mcmd.exe 2475.41 COMMAND LINE USAGE pay kiname Kf name $K.XX Users John Desktop General CNDebug pay Joe Blow $2475.41 ay to the order of Joe Blow 2475.41 wo thousand four hundred seventy five and 41/100 igned Boss Man Users John Desktop General CNDebug pay Joe Blow $405.41 ay to the order of Joe Blow 405.41 hundred five and 41/100 our igned Boss Man C: Users John Desktop General CVDebug Here is much of the code, you will have to extend this to get it working for hundreds and "tentys Sample Code char numstrings[] use numstringslargv[3][x] '0'][0] to check this null One two three four five Sl X Seven eight nine do thousands if(len 7) there must be thousands Example: 01234567 indexes when argv [3] $2475.41 len argv[3][len 7] '2' numstrings [2] two printf (numstrings [argv[3][len 7] '0' J); printf(" thousand pass the address of the start of the pennies printf(" and %s/100 &argv;[3][len 2]);Explanation / Answer
#include using namespace std; int main() { int low, high, i, flag; cout > low >> high; coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.