View Single Post
 2021-03-21, 15:06 #1012 garambois     "Garambois Jean-Luc" Oct 2011 France 7·97 Posts Please I am unable to add the correct line of code to write this in bold below in my save file called "power_abundant_exponents" : 30 55440 (base + exponent) As you can see, I only manage to write the exponent i and not the base, because I don't know the equivalent for "base" of "% d" that works for i. I do not know the type of "base". By the way, "% d" does not seem correct to me for the variable i, because it can be very large ! But it seems to work ! Code:  if (n > partial) { fff = fopen ("power_abundant_exponents", "a"); if (fff == NULL) printf("Impossible to open file !"); else { fprintf (fff, "%d\n",i); fclose (fff); cout << base.get_str() << "^" << i << " is abundant !" << endl; }; } else { // cout << base.get_str() << "^" << i << " is not abundant." << endl; }