amir ghasemiyan
سه شنبه 09 اردیبهشت 1393, 21:56 عصر
سلام دوستان
من يه كد نوشتم. نميدونم براي چي گير ميده. مشكلش رو نميفهمم. ممنون ميشم راهنماييم كنين
118486
#include <iostream>
#include <array>
using namespace std;
int maghlub(int temp)
{
int b=0,c=0;
while (temp>0){
c=temp%10;
temp=int(temp/10);
b=(b*10)+c;
}
return b;
}
int main()
{
int a,aa;
int c,d,dd,temp;
int i=0,j;
int *count = new int[90];
for (a=10;a<100;a++)
{
i=0;
aa=a;
while (i==0)
{
int b=0;
b=maghlub(aa);
d=a+b;
cout<<d<<"\n";
dd=maghlub(d);
cout<<dd<<"\n";
if (d==dd)
{
i=1;
cout<<"maghlub jame "<<a<<" ba maghlubesh adadi maghlub ast\n";
}
else
{
cout<<"maghlub "<<a<<" ba khodesh barabar nist\n";
aa=d;
count[j]++;
}
}
cout<<count[j]+1<<"\n";
j++;
}
}
من يه كد نوشتم. نميدونم براي چي گير ميده. مشكلش رو نميفهمم. ممنون ميشم راهنماييم كنين
118486
#include <iostream>
#include <array>
using namespace std;
int maghlub(int temp)
{
int b=0,c=0;
while (temp>0){
c=temp%10;
temp=int(temp/10);
b=(b*10)+c;
}
return b;
}
int main()
{
int a,aa;
int c,d,dd,temp;
int i=0,j;
int *count = new int[90];
for (a=10;a<100;a++)
{
i=0;
aa=a;
while (i==0)
{
int b=0;
b=maghlub(aa);
d=a+b;
cout<<d<<"\n";
dd=maghlub(d);
cout<<dd<<"\n";
if (d==dd)
{
i=1;
cout<<"maghlub jame "<<a<<" ba maghlubesh adadi maghlub ast\n";
}
else
{
cout<<"maghlub "<<a<<" ba khodesh barabar nist\n";
aa=d;
count[j]++;
}
}
cout<<count[j]+1<<"\n";
j++;
}
}