0% found this document useful (0 votes)
643 views5 pages

Flower Pot Program in C

This document contains code for a program to design a flower pot using graphics functions in C. It includes functions to initialize the graphics system, display petals in random colors radiating out from the center in a spiral pattern, draw the pot bucket shape, and call the other functions from main to display the completed pot design.

Uploaded by

Bharat Kumavat
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
643 views5 pages

Flower Pot Program in C

This document contains code for a program to design a flower pot using graphics functions in C. It includes functions to initialize the graphics system, display petals in random colors radiating out from the center in a spiral pattern, draw the pot bucket shape, and call the other functions from main to display the completed pot design.

Uploaded by

Bharat Kumavat
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

/* Program to design flower pot*/ ?#?include?<stdio.h> #include<dos.h> #include<graphics.h> #include<stdlib.h> #include<math.h> #include<conio.h> ?#?define? PI 3.

14159 #define NUME 30 #define DENOM 100 #define NUMBER 7 #define RAD 2.0 #define DTHETA 0.1 #define REDUX 3 #define SEGS 60 #define MIN 1 void init_graph(); void tdisplay(int, float, int, int, int); void cdisplay(int, int, int); void bucket(); int gd, gm, maxcolor, errorcode; int xo, yo, maxx, maxy, xasp, yasp; double aspectratio; void init_graph() {

detectgraph(&gd, &gm); initgraph(&gd, &gm, ""); errorcode = graphresult(); if (errorcode != grOk) { printf("graphics system eror : %s", grapherrormsg(errorcode)); exit(1); } maxcolor = getmaxcolor() + 1; getaspectratio(&xasp, &yasp); aspectratio = (double) (yasp) / (double) (xasp); maxx = getmaxx(); maxy = getmaxy(); }

void cdisplay(int size, int x, int y) { int i, rc; float theta; for (i = 0; i < NUMBER; i++) { theta = i * 2 * PI / NUMBER; rc = random(16); tdisplay(size, theta, x, y, rc); } }

void tdisplay(int size, float theta, int x, int y, int rcolor) { int i, chg, newsize; for (i = 0; i < size; i++) { chg = (random(DENOM) < NUME) ? -1 : 1; theta += chg * DTHETA; x += RAD * sin(theta); y += RAD * cos(theta); if (size < 4) setcolor(rcolor); else if (size < 13) setcolor(GREEN); else if (size < 40) setcolor(LIGHTGREEN); else setcolor(YELLOW); lineto(x, y); } if (size > MIN) { newsize = size / REDUX; cdisplay(newsize, x, y); } }

void bucket()

{ setcolor(WHITE); ellipse(xo, yo, 0, 360, 30, 9); setfillstyle(SOLID_FILL, RED); fillellipse(xo, yo, 30, 9); setfillstyle(LTBKSLASH_FILL, BROWN); ellipse(xo + 30, yo + 28, 90, 252, 12, 25); delay(1150); ellipse(xo - 30, yo + 28, -70, 94, 12, 25); delay(1150); ellipse(xo + 25, yo + 83, -69, 90, 12, 30); delay(1150); ellipse(xo - 25, yo + 83, 88, 252, 12, 30); delay(1150); ellipse(xo, yo + 116, 151, 388, 32, 9); delay(1150); floodfill(xo, yo + 50, WHITE); }

void main() { int size; init_graph(); xo = maxx >> 1; yo = (maxy >> 1) - 80;

xo++; yo++; bucket(); randomize(); size = SEGS; delay(1150); cdisplay(size, xo, yo); getch(); closegraph(); }

Rejection is Gods way of saying, wrong direction

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy