What is wrong with my little programm?
This program made in MinGW should decompose numbers in prime factors. MinGW doesn’t say that there is on error, but the program does nothing:
#include<iostream.h>
#include<math.h>
int main(void)
{
int i,j,a,b=1;
cout<<“Introduceti numarul”<<endl;
cin>>a;
struct descomp
{int baza,exp;};
descomp x[20];
for(i=1;i<=a;i++)
{
j=0;
while(a%i==0)
{
a=a/i;
j+=1;
}
if(j>=1)
{
x[b].baza=i;
x[b].exp=j;
b+=1;
}
}
for(i=1;i<=b;i++)
cout<<x[i].baza<<”^”<<x[i].exp<<endl;
return 0;
}
What is wrong with it?
Observing members:
0
Composing members: 0
Composing members: 0