Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<conio.h>
- #include<graphics.h>
- #include<dos.h>
- #include<math.h>
- int main(){
- initwindow(640,320);
- float f1 = 0, f2 = 0;
- setcolor(RED);
- for(float x = 0.; x < 2.1; x+=0.1){
- f1 = pow(x,3);
- f2 = sqrt(x);
- line((x - 0.1) * 100, pow(x - 0.1,3) * 100 + 160, x * 100, f1 * 100 + 160);
- line((x-0.1) * 100, sqrt(x-0.1) * 100 + 160 , x * 100, f2 * 100 + 160);
- }
- setfillstyle(1,4);
- floodfill(10,161,4);
- outtextxy ( 20, 300, "f(x)=pow(x,3);" );
- outtextxy ( 120, 250, "f(x)=sqrt(x);" );
- setcolor(WHITE);
- moveto(0,0);
- lineto(0,320);
- moveto(0,160);
- lineto(640,160);
- getch();
- closegraph();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement