سلام اینم برنامه:
#include<iostream.h>
#include<conio.h>
void main(void)
{
l:
int a[10],b[10],c[20],i,j,k,temp=0,bagi=0,temp1=0,sefr=0,key=0;
char ch;
cout<<"----------------------------------START------------------------------------------";
cout<<endl;
for (i=0;i<10;i++)
{
cout<<"Please Enter The Frist Number "<<i<<"=";
cin>>a;
}
for (i=0;i<10;i++)
{
cout<<"Please Enter The Second Number "<<i<<"=";
cin>>b;
}
for (i=0;i<20;i++)
c=0;
for (i=9;i>=0;--i)
{
temp=0;
bagi=0;
temp1=0;
for (j=9;j>=0;--j)
{
k=b*a[j]+temp;
temp=k / 10;
bagi=k % 10;
c[(j-sefr)+10]=c[(j-sefr)+10]+bagi+temp1;
temp1=c[(j-sefr+10)]/10;
c[(j-sefr)+10]=c[(j-sefr)+10]%10;
if (j==0)
{
c[(j-sefr)+9]=temp;
c[(j-sefr)+9]=c[(j-sefr)+9]+temp1;
}
}
++sefr;
}
cout<<endl;
cout<<endl;
cout<<endl;
cout<<"Result: ";
for (i=0;i<10;i++)
{
cout<<a;
}
cout<<" * ";
for (i=0;i<10;i++)
{
cout<<b;
}
cout<<" = ";
for (i=0;i<20;i++)
{
cout<<c;
}
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<"Press 1 & Enter To Cuntinue Press Any Key & Enter For Exit...";
cin>>key;
if (key==1)
goto l;
}
یا یه برنامه توپاسکال بنویسید که اعداد بزرگ رو ضرب کنه (با آرایه)
مرسی
#include<iostream.h>
#include<conio.h>
void main(void)
{
l:
int a[10],b[10],c[20],i,j,k,temp=0,bagi=0,temp1=0,sefr=0,key=0;
char ch;
cout<<"----------------------------------START------------------------------------------";
cout<<endl;
for (i=0;i<10;i++)
{
cout<<"Please Enter The Frist Number "<<i<<"=";
cin>>a;
}
for (i=0;i<10;i++)
{
cout<<"Please Enter The Second Number "<<i<<"=";
cin>>b;
}
for (i=0;i<20;i++)
c=0;
for (i=9;i>=0;--i)
{
temp=0;
bagi=0;
temp1=0;
for (j=9;j>=0;--j)
{
k=b*a[j]+temp;
temp=k / 10;
bagi=k % 10;
c[(j-sefr)+10]=c[(j-sefr)+10]+bagi+temp1;
temp1=c[(j-sefr+10)]/10;
c[(j-sefr)+10]=c[(j-sefr)+10]%10;
if (j==0)
{
c[(j-sefr)+9]=temp;
c[(j-sefr)+9]=c[(j-sefr)+9]+temp1;
}
}
++sefr;
}
cout<<endl;
cout<<endl;
cout<<endl;
cout<<"Result: ";
for (i=0;i<10;i++)
{
cout<<a;
}
cout<<" * ";
for (i=0;i<10;i++)
{
cout<<b;
}
cout<<" = ";
for (i=0;i<20;i++)
{
cout<<c;
}
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<"Press 1 & Enter To Cuntinue Press Any Key & Enter For Exit...";
cin>>key;
if (key==1)
goto l;
}
یا یه برنامه توپاسکال بنویسید که اعداد بزرگ رو ضرب کنه (با آرایه)
مرسی
آخرین ویرایش: