HOMEWORK SUBMIT system: C++ Homework SUBMISSION for C++ Assignments for Jacobson
polynomials.cppDUE BY 11:30 pm on Tuesday April 5th.
Poly #1: 6 5 3 2 <--- Exponents 123.4x 11.1x 3.2x 17x <--- Coefficients + "x" Poly #2: 7 6 4 2 0 5.5x -123.4x 12.3x 12.21x 105x Poly #1 + #2: 7 5 4 3 2 0 <--- Exponents 5.5x 11.1x 12.3x 3.2x 29.21x 105x <--- Coefficients + "x"
VIP: the backslash 0 null character: '\0' signals the end of the "C STRING".
How does the nameSlice() void function use what char.cpp
demonstrates? Page 570 or handout.
Enter a dollar amount in the form nnnnn.nn please: 43123.75 Here is the amount formatted: $43,123.75 Study the dollarFormat() void function and the C++ string class find() and insert() methods. Note that dollarFormat() has one argument, and that argument is passed by REFERENCE.
jacobson[weblab]:~$ g++ currency.cpp jacobson[weblab]:~$ ./a.out Enter a dollar amount in the form nnnn.nn : 1234567890.75 Here is the amount formatted: $1,234,567,890.75 Question: Using your textbook and/or the handout: 1. What was the value of int variable dp? 2. trace the code and tell exactly what values that for loop index x took on for the above example.
void dollarFormat(string ¤cy) // <====== (Why the "&"?) { int dp; dp = currency.find('.'); if (dp > 3) for (int x = dp - 3; x > 0; x-= 3) currency.insert(x, ","); currency.insert(0, "$"); }
jacobson[weblab]:~$ ./a.out Enter a dollar amount in the form nnnn.nn : 1234567.25 Here is the amount formatted: $1,234,567.25
Always very vigorously separate WHAT from HOW!
Page 107 of a book of speeches and articles by EWD (Edsgar W. Dijkstra) on the 10% of the teaching programming versus the hidden 90% of what programming and problem solving involve. The VET who SAT down to watch AUC (All U Children) on TVV, SO what if this was at the YMDC (i.e., the YMCA in Washington, DC) where the Gulf War or Vietnam Vet was staying. VET-SAT-AUC, TVV-SO-YMDC is the string of the first letters from a quote by Dijkstra. Programming, when stripped of all the circumstantial irrelevancies is nothing more and nothing less than "very effective thinking so as to avoid unmastered complexity, to very vigorous separation of your many different concerns". very effective thinking so as to avoid unmastered complexity, v e t s a t a u c = vet sat auc vet sat auc VET SAT AUC to very vigorous separation of your many different concerns. t v v s o y m d c = tvv so ymdc tvv so ymdc TVV SO YMDC
YMDC becomes YTDC, i.e. Your Two Different Concerns...
or perhaps
YTMC, i.e. Your Two Main Concerns. Very Vigorously Separate YTMC!
YTCC has a nice poetic sound Y T C C - Your Two Chief Concerns...
2 3 4 2 2 2 4/8/16 and 11 years until 3/9/27
I do not know where family doctors acquired illegibly perplexing handwriting; nevertheless, extraordinary pharmaceutical intellectuality, counterbalancing indecipherability, transcendentalizes intercommunications' incomprehensibleness.
I do not know where family doctors acquired illegibly perplexing handwriting nevertheless extraordinary pharmaceutical intellectuality counterbalancing indecipherability transcendentalizes intercommunications incomprehensibleness
The output is: jacobson[weblab]:~/web/cpp$ cat snowOutput.txt jacobson[weblab]:~$ ./a.out I 1 do 4 not 8 know 13 where 19 family 26 doctors 34 acquired 43 illegibly 53 perplexing 64 handwriting; 77 -1 I do not know where family doctors acquired illegibly perplexing handwriting; I do not know where family doctors acquired illegibly perplexing handwriting; 012345678901234567890123456789012345678901234567890123456789012345678901234567 1 2 3 4 5 6 7snowOutput.txt