912-17 guruh talabasi
Karimov Islomning sonli
usullar va dasturlash fanidan
1-Laboratoriya ishi
Kirish:
Biz bu dasturimizda berilgan sonlar, va fizik o’lchashlar va hisob kitob ishlari olib borishdagi olingan natijalarda hatoliklar , hisobash xatosi va yo’qotilmas hatolarni aniqlashda qo’llaniladi. Masaln biz oddiy hisoblashda pi 3.14 sonini olamiz aslida esa u 3.1415… qiymatga ega.
Blok sxema:
Boshlash
a, a1, a0, dE1, E1, F1
b, b1, b0, dE2, E2, F2, n1=0
n2=0, m1, m2, aw, dEE1, dEE2
i=1, i<=7
aw%10 aw=aw/10;
n1++;m1=7-n1
dEE1=aw%100
a0=aw/(pow(10,m1)) dEE1>50 a0=aw/100+1;
a0=a0/(pow(10,m1-2))
dE1=1/pow(10,m1);
a1=fabs(a0-a);
E1=a1+dE1;
F1=(E1*1.0)*100/(a0);
a0, a1, E1, F1
i=1, i<=7
bw%10 bw=bw/10;
=0 n2++;m2=7-n2
dEE2=bw%100
b0=bw/(pow(10,m2)) dEE2>50 b0=bw/100+1;
b0=b0/(pow(10,m2-2))
dE2=1/pow(10,m2);
b1=fabs(b0-b);
E2=b1+dE2;
F2=(E2*1.0)*100/(b0);
aa,x,aa0,aa2,aa3,aa4,A1,A2
A3,A4,D,y,aaw;
aa=aa*100000000
aaw=aa;
n=0, m=0
j=1, j<8
aaw%10 aaw=aaw/10;
=0 n++; m=8-n
aa=aa/(pow(10,n));
D=aa0;
j=0, j
aa=aa*1.0/(pow(10,1));
q=aa
)
)
D0=(aa-q)*1.0/(pow(10,m-i))
D
i+1, D
A, B, Aa=A*B/100
1-ish.
Dastur kodi (c++ da):
#include
using namespace std;
int main (){
// 1-MISOL//////////////////////////////////////////////////////////
double a=0, a1,a0,dE1,E1,F1;
double b=0, b1,b0,dE2,E2,F2;
cout<<"a="; cin>>a;
cout<<"b="; cin>>b;
int n1=0,m1,aw,dEE1;
int n2=0,m2,bw,dEE2;
aw=a*pow(10,7);
bw=b*pow(10,7);
for (int i=1; i<=7; i++){
if(aw%10==0){
aw=aw/10;
n1++;
m1=7-n1;
}
}
// a misolniki
dEE1=aw%100;
if(dEE1 > 50){
a0=aw/100+1;
a0=a0/(pow(10,m1-2));
}
else {
a0=aw/(pow(10,m1));
}
dE1=1/pow(10,m1);
a1=fabs(a0-a);
E1=a1+dE1;
F1=(E1*1.0)*100/(a0);
cout<<"---------------------------\na0= "<
printf("F1= %.3f",F1); cout<<" %";
cout<
// b misolniki
for (int i=1; i<=7; i++){
if(bw%10==0){
bw=bw/10;
n2++;
m2=7-n2;
}
}
// a misolniki
dEE2=bw%100;
if(dEE2 > 50){
b0=bw/100+1;
b0=b0/(pow(10,m2-2));
}
else {
b0=bw/(pow(10,m2));
}
dE2=1/pow(10,m2);
b1=fabs(b0-b);
E2=b1+dE2;
F2=(E1*1.0)*100/(b0);
cout<<"b0= "<
printf("F2= %.2f%",F2);
cout<<" %\n---------------------------\n\n";
// 2- a) MISOL///////////////////////////////////////////////////////////
double aa,x,aa0,aa2,aa3,aa4,A1,A2,A3,A4,D,y;
int aaw;
cout<<"a= "; cin>>aa;
cout<<"a0= "; cin>>aa0;
cout<<"\n";
aa=aa*100000000; //10^8
aaw=aa;
int n=0,m=0;
for (int j=1; j<8; j++){
if(aaw%10==0){
aaw=aaw*1.0/10;
n++;
m=8-n;
}
}
//aa1=aaw%10;
//x=1/(pow(10,m));
//A1=aa0+x;
aa=aa/(pow(10,n));
D=aa0;
for (int i=0; iaa=aa*1.0/(pow(10,1));
int q=aa;
cout<<"a="<
cout<<"a'="<
double D0=(aa-q)*1.0/(pow(10,m-i));
D+=aa0+D0;
cout<<"D"<
}
// 2- b) MISOL///////////////////////////////////////////////////////////
double A,B;
cout<<"A="; cin>>A;
cout<<"B="; cin>>B;
double Aa=A*B*1.0/100;
int daraja=7;
A=A*pow(10,daraja);
n=0;
int Aint=A;
for (int j=0; j
if(Aint%10==0){
Aint=Aint/10;
n++;
m=7-n;
}
}
Aint=Aint%100;
double Aa1;
Aa1=Aint/(pow(10,m))+Aa;
cout<<"Aa1="<}8>
Do'stlaringiz bilan baham: |