Beruflich Dokumente
Kultur Dokumente
Faculty CIM
Report
on Labaratory Work nr.1
at Computer Programming realized in C++
Subject: Employment of Control and Looping Function
V-5
Accomplished : st.gr.FAF-081
Colun Mihai
Checked by:
Kulev Mihail
Chisinau 2008
LABWORK NR.1
1
ax b
x a
F
sin x
10 x
c 6
, if + < 0 and = 0;
, if + a > 0 and 0;
, in other cases.
Start
Clrscr()
a,b,c,x1, x2,dx
Results\n
OP
OP=1
.
.
.
x=x1, x<=x2,
x=x+dx
x+c<0 &&
b=0
NO
YES
F=(a+b)/log(x-c)
x+c>0 && b!
=0
YES
NO
F=(sin(a)-x+3)/(c*c)
F=(4*x*x+8)/(a*a*x)+sin(x)
Getch()
"<%i> x=%.2f; F=%.3f\n",op,x,F
op=op+1
STOP
Program:
# include <stdio.h>
# include <math.h>
# include <conio.h>
int main()
{float a,b,c,x,x1,x2,D,F;
int op;
clrscr();
printf("introduceti datele a,b,c,x1,x2,D\n");
scanf("%f%f%f%f%f%f",&a,&b,&c,&x1,&x2,&D);
printf("results: \n");
op=1;
for(x=x1;x<=x2;x=x+D)
{if ((x+c<0)&&(b==0)) F=(a+b)/log(x-c);
else if ((x+c>0)&&(b!=0)) F=(sin(a)-x+3)/(c*c);
else F=(4*x*x+8)/(a*a*x)+sin(x);
printf("<%i> x=%.2f; F=%.3f\n",op,x,F);
op=op+1;
}
getch();
return 0;
}
Results on screen: