Minggu, 23 Maret 2014
Pertemuan 04. E-Book Program to draw a quilt
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;
}
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar