#include #include int main() {
int number = 1234567;
int digits = log10(number)+1;
printf("%d has %d digits\n",number,digits);
}
Jerry Jeremiah
Posts
-
Plz solve it -
AVI files to DVD- Product recomendation?I recently used ConvertXtoDVD[^] and I thought it worked excellently. I haven't used the other ones that everyone else is suggesting so I can't compare...
-
How can Extract String ?or sscanf() ... He did say the string always had the exact same format ...
-
Fun with decompiled code.Not only that. Think of the SQL injection you could do...
-
Ominous bug from DLL world [modified]Ok, Maybe you can tell me what is wrong with this. When I run this, it dies with memory corruption in the find statement in the Execute function. I pass the pointer to keep the map from being copied (since it might get huge in a real project) To me there is no obvious reason why. // The DLL #include #include using namespace std; typedef map<string,string> param_t; __declspec(dllexport) bool Execute(param_t *params){ params->find("xyz"); return true; } // The EXE #include #include using namespace std; typedef map<string,string> param_t; __declspec(dllimport) bool Execute(param_t *params); int main() { param_t params; params["xyz"]="abc"; params.find("xyz"); // test it here before we call the other function return Execute(¶ms); } I was using Visual C++ 6.0. Compiling it with any other compiler seems to work fine (including newer versions of Visual C++)
-
strange sumYou can tell when a company goes to a lot of effort to make their compiler easy to use. The most expensive part of a project is the amount of debugging and fixing bugs. A compiler that can save this much time is a Good Thing.
-
Formula to calculate Equal Monthly PaymentsTake a look at this article from the FAQ of Dr. Math: http://www.mathforum.org/dr.math/faq/faq.interest.html[^] In an installment loan, a lender loans a borrower a principal amount P, on which the borrower will pay a yearly interest rate of i (as a fraction, e.g. a rate of 6% would correspond to i=0.06) for n years. The borrower pays a fixed amount M to the lender q times per year. At the end of the n years, the last payment by the borrower pays off the loan. The amount of the fixed payment is determined by: M = P * i / [ q (1 - [1+( i / q)]^(-n* q) ) ] M = 2500 * 2.399961 / [26 (1 - [1+(2.399961/26)]^(-1*26) ) ] 674653127756771870877187207 (which, when rounded to 2 dp is $256.61) The total amount paid by the borrower is Mnq, and the total amount of interest paid is I = Mnq - P: I = M * n * q - P I = 256.60 * 1 * 26 - 2500 I = 4171.7754098132167606864280686738 (which, when rounded is $4171.78) That is a lot of interest! Jerry http://www.mathforum.org/dr.math[^]