主题:请教各位大侠???????
//分解成质因子相乘
#include<iostream.h>
#include<math.h>
void main ()
{
int i,n,m;
cout<<"请输入一个数:";
cin>>n;
for(i=2;i<=n;i++)
{
while (n!=i)
{
if (n%i==0)
cout<<"m*"<<i;
n=n/i;
else
break;
}
}
cout<<"m"<<n;
}
提示有错为:error C2181: illegal else without matching if
谢谢了!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#include<iostream.h>
#include<math.h>
void main ()
{
int i,n,m;
cout<<"请输入一个数:";
cin>>n;
for(i=2;i<=n;i++)
{
while (n!=i)
{
if (n%i==0)
cout<<"m*"<<i;
n=n/i;
else
break;
}
}
cout<<"m"<<n;
}
提示有错为:error C2181: illegal else without matching if
谢谢了!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!