Yes, I have yet another question.
Is there any way to get rid of the 'e+number' and have it just show the number right out? I have got some code but the e+ thing keeps getting annoying.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <iostream>
usingnamespace std;
int main()
{
double motd; //Money Of The Day
double total;
int day = 1;
for(motd = 0.01, total += motd;day <= 30;motd *= 2, total += motd, day++)
{
cout << "Day: " << day << " Amount of the Day: " << motd << " Total Amount: " << total
<< "\n\n";
}
cin.get();
return 0;
}
Nope, I don't think you can do that, unless you are planning to make the code check to see if the number is over 1+e10 (i think that is when it starts), and then remove that many zeros from the end and then manually append them.
You might be able to do it this way:
1 2 3 4 5 6 7 8 9 10 11 12
string sci_int_to_string(int number) {
string buffer;
int b = 0;
for(int a = number; a > 1000000000; a /= 10) {
b++;
}
buffer = inttostr(number); //not a real function...I made a custom function for that, but I don't remember how I did it...I'll try to find it
for(int c = 0; c <= b; c++) {
buffer.append("0");
}
return buffer;
}