Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <graphics.h>
- #include <conio.h>
- #include <dos.h>
- #include <time.h>
- #include <stdlib.h>
- using namespace std;
- int main()
- { int x[10],s=0, n,k,j;
- int culoare=1;
- cout<<"cate numere se citesc ? ";
- cout<<endl;
- cin>>n; //citeste cate numere sunt
- for(int i=1;i<=n;i++) //
- {
- cout<<"x=";//citeste termenii sumei
- cin>>x[i];
- s=s+x[i];//suma
- }
- initwindow(1000,1000);//creeearea paginii
- setcolor(10);
- rectangle(40,10,100+s*60,80);//crearea careului
- setfillstyle(SOLID_FILL,10);//umplere
- floodfill(99+s*60,11,10);
- for( j=1;j<=s;j++)
- {
- setcolor(culoare);
- circle (50+j*60 ,50 ,20);//desenare cercuri in fct de j
- setfillstyle(SOLID_FILL,culoare);//umplere
- floodfill(50+j*60 ,50 ,culoare);
- culoare ++;
- }
- getch();
- closegraph();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement