#include<iostream>
#include<iomanip>
#include<string>
#include <stdlib.h>
using namespace std;
void Analyze();
void figure(long n);
double transformer(string& s);
double transformer(string& s)
{
while(s.find(",") != string::npos) {
s.erase(s.find(","), 1);
}
return atof(s.c_str());
}
void Analyze_And_Input()
{
double transformer(string&);
static int m=0;
string (q);
cout<<"输入数据(类型为 long)程序将分解质因数,输入0可退出。/n"<<endl;
cin>>q;
if(m>2){system("cls");cout<<"Compiled By:Ms"<<endl;m=0;}
m++;
double temp1=transformer(q);
if (temp1==0.618){cout<<"Life is brilliant!/n/n/n/nHowever, "; cin.get();}
if (temp1==-0.618){cout<<"SB Andy!/n/n/n/nHowever, "; cin.get();}
if (temp1==3.14){cout<<"Pi is beatiful!/n/n/n/nHowever, "; cin.get();}
if (temp1==2.718){cout<<"e:Nature is maganificant!/n/n/n/nHowever, "; cin.get();}
double transformer(string&);
string num("1234567890");
string::size_type pos=0;
while((q.find_first_not_of(num,pos))!=string::npos)//看其中是否有非数字成分
{
cout<<"您的输入不是符合条件的正整数!/n"<<endl;
++pos;
cin.get();
Analyze_And_Input();
}
double transformer(string&);
double temp=transformer(q);
long n;
n=(long)temp;
if(n==0) exit(0);
if(n<=1)
{
cout<<"Error 输入数据必须大于等于1!/n"<<endl;
cin.get();
Analyze_And_Input();
}
else {figure(n);}
}
void figure(long n)
{
int count=0;
long t=0;
cout<<n<<"="<<" ";
for(long i=2;i<=n;i++)
{
t=n%i;
if(t==0)
{
n=n/i;
cout<<i;
if(i<=n-1)
cout<<" * ";
i--;
count++;
if(count%5==0)
cout<<" "<<endl;
}
}
cout<<"/n输入数据的质因数有"<<count<<"个。/n"<<endl;
cin.get();
Analyze_And_Input();
}
int main()
{
Analyze_And_Input();
return 0;
}