5.11 Figure 5.22 Program to draw a quilt
#include <cstdlib>
#include <iostream>
using namespace std;
int main(void)
{
int x1,y1,x2,y2,stepX,stepY,foreColor,numBars,width, height;
cout<<"Enter number of bars> ";
cin>>numBars;
width = getmaxwidth();
height = getmaxheight();
initwindow(width, height, "Quilt");
x1=0;
x2=width;
y1=0;
y2=height;
stepX = width/(2 * numBars);
stepX = height/(2 * numBars);
for (int i= 1; i<= numBars; ++i){
foreColor= i%16;
setcolor(foreColor);
setfillstyle(i%12, foreColor);
bar(x1, y1, x2, y2);
x1 = x1 + stepX;
y1 = y1 + stepY;
x2 = x2 - stepX;
y2 = y2 - stepY;
}
closegraph();
system("PAUSE");
return EXIT_SUCCESS;
}
Tugas Kelompok ebook chapter 5 Alpro
| Judul | : | Tugas Kelompok ebook chapter 5 Alpro |
| Url | : | https://fiqriany1300018072.blogspot.com/2014/03/tugas-kelompok-ebook-chapter-5-alpro_167.html |
| Pada | : | Senin, 24 Maret 2014 |
| Oleh | : | Unknown |
| Respond | : | 0 |
| Share | : |
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar