Hello all, I need help with a scientific notation problem. I am to create a program where the user enters a 5 digit number, and it is displayed in scientific notation. This part is easy, however I am trying to take it to the next step and make it so '0's do not show up.
So 40587 = 4x10000 + 5x100 + 8+10 + 7
*notice the 0 is not in the equation.
well I got quite far in my code, and got it to finally work. HOWEVER although it works, I still get an error message when the code runs..
Help?
#include<iostream>
using namespace std;
int main()
{
int number, notation=10000;
cout << "Enter a five digit number: ";
cin >> number;
cout << endl << number << " = ";
for(int x=0;x<5;x++){
if((number/notation)%10 != 0){
cout << (number/notation)%10;
if(notation > 1)
cout << "x" << notation;
if(((number/(notation/10))%10 != 0)||(notation != 10))
cout << " + ";
}
notation /= 10;
}
cout << endl << endl;
}