UrbanPro

Learn C Language from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

Can anybody provide me error free coding for graphic program in C??? Animated Smiley program Rotating Fan progran Sunrise program

Asked by Last Modified  

Follow 0
Answer

Please enter your answer

Project Development: Custom Training and Software based Project Development Company

#include graphics.h #include conio.h #include stdlib.h #include dos.h main() { int gd = DETECT, gm,area,temp1,temp2,left =25,top=75; void *p; initgraph(&gd,&gm,”C:\\TC\\BGI”); setcolor(YELLOW); circle(50,100,25); setfillstyle(SOLID_FILL,YELLOW); floodfill(50,100,YELLOW); setcolor(BLACK); setfillstyle(SOLID_FILL,BLACK); fillellipse(44,85,2,6); fillellipse(56,85,2,6); ellipse(50,100.205,335,20,9); ellipse(50,100.205,335,20,10); ellipse(50,100.205,335,20,11); area...
read more
#include graphics.h #include conio.h #include stdlib.h #include dos.h main() { int gd = DETECT, gm,area,temp1,temp2,left =25,top=75; void *p; initgraph(&gd,&gm,”C:\\TC\\BGI”); setcolor(YELLOW); circle(50,100,25); setfillstyle(SOLID_FILL,YELLOW); floodfill(50,100,YELLOW); setcolor(BLACK); setfillstyle(SOLID_FILL,BLACK); fillellipse(44,85,2,6); fillellipse(56,85,2,6); ellipse(50,100.205,335,20,9); ellipse(50,100.205,335,20,10); ellipse(50,100.205,335,20,11); area = imagesize(left,top,left+50,top+50); p = malloc(area); setcolor(WHITE); settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2); outtextstyle(155,451,”Smiling face Animation”); setcolor(BLUE); rectangle(0,0,639,449); while(!kbhit()) { temp1 = 1 + random(588); temp2 = 1 + random(380); getimage(left,top,left+50,top+50,p); putimage(temp1,temp2,p,xor_put); delay(100); left = temp1; top = temp2; } getch(); closegraph(); return 0; } Happy coding! Enjoy! 2. Rotating Fan program #include graphics.h //for graphics #include stdio.h //standard input/output #include string.h //string function #include conio.h //console input output #include math.h //math calculation #define PI 3.14 //value constant pi=3.14 char speed[4]; //array declaration for speed int theta=0,change=1,temp=0,ch; float x,y,r=100; void main() { int gd=DETECT,gm; initgraph(&gd,&gm,"c:\\tc\\bgi"); //path where ur BGI file is stored strcpy(speed,"on 1"); outtextxy(200,20,"Working Fan"); outtextxy(150,50,"Use number 0 1 2 3 to change fan speed"); outtextxy(475,375,"Fan Speed"); fan: do { cleardevice(); outtextxy(200,20,"Working Fan"); outtextxy(150,50,"Use number 0 1 2 3 to change fan speed"); outtextxy(475,375,"Fan Speed"); if(kbhit()) { ch=getch(); if(ch=='0') { rectangle(495,395,535,410); floodfill(515,405,15); temp=1; } if(ch=='1') { strcpy(speed,"on 1"); change=1; } else if(ch=='2') { strcpy(speed,"on 2"); change=3; } else if(ch=='3') { strcpy(speed,"on 3"); change=18; } } outtextxy(500,400,speed); circle(320,240,(r/12)); circle(320,240,(r/6)); circle(320,240,(r/4)); x=r*(cos((PI * theta)/180)); y=r*sin((PI * theta)/180); line(320+(x/4),240+(y/4),320+(1.6*x),230+(1.6*y)); /*draw the line for fan*/ line(320+(x/4),240+(y/4),320+(1.6*x),250+(1.6*y)); line(320+(1.6*x),230+(1.6*y),320+(1.6*x),250+(1.6*y)); x=r*cos((PI *(theta+120))/180); y=r*sin((PI *(theta+120))/180); line(320+(x/4),240+(y/4),320+(1.6*x),230+(1.6*y)); line(320+(x/4),240+(y/4),320+(1.6*x),250+(1.6*y)); line(320+(1.6*x),230+(1.6*y),320+(1.6*x),250+(1.6*y)); x=r*cos((PI * (theta+240))/180); y=r*sin((PI * (theta+240))/180); line(320+(x/4),240+(y/4),320+(1.6*x),230+(1.6*y)); line(320+(x/4),240+(y/4),320+(1.6*x),250+(1.6*y)); line(320+(1.6*x),230+(1.6*y),320+(1.6*x),250+(1.6*y)); if(temp!=1) delay(36/change); else { ch=getche(); if(ch=='\r') exit(0); if(ch=='0') temp=1; if(ch=='1') //for speed { strcpy(speed,"on 1"); temp=0; change=1; } else if(ch=='2') { strcpy(speed,"on 2"); temp=0; change=3; } else if(ch=='3') { strcpy(speed,"on 3"); temp=0; change=18; } else { strcpy(speed,"off!"); temp=1; } } if(theta==360) theta=0; theta++; } while(temp==0); goto fan; } 3. Sunrise program:- #include graphics.h #include conio.h #include stdio.h void main() { int gd=DETECT,gm; int i,j,k,t,q; float x,y; initgraph(&gd,&gm,"c:\\tc\\bgi"); setcolor(2); rectangle(0,0,getmaxx(),getmaxy());  setcolor(2);  i=0; for(t=0;t getmaxx();t+=120) { line(t,250,t+60,170); line(t+60,170,t+120,250); } line(0,400,getmaxx(),350); setfillstyle(11,CYAN); floodfill(2,420,2); setfillstyle(4,LIGHTGREEN); floodfill(1,300,2); i=0; while(i!=150) { setcolor(BLACK); setfillstyle(SOLID_FILL,BLACK); fillellipse(k,j,30,30); setfillstyle(SOLID_FILL,LIGHTRED); fillellipse(170+i,235-i,30,30); j=235-i; k=170+i; i++; setcolor(2); for(t=0;t getmaxx();t+=120) { line(t,250,t+60,170); line(t+60,170,t+120,250); } setfillstyle(1,GREEN); floodfill(202,200,GREEN); delay(25); } for(i=36;i 80;i++) for(j=0;j =360;j+=20) { x=319+i*cos(((float)j*3.14)/180); y=86+i*sin(((float)j*3.14)/180); putpixel(x,y,LIGHTRED); delay(1); } getch(); } read less
Comments

Please consider giving more details,as to where you want to use this program.
Comments

Computer Language Expert

DO you want to learn C graphics? or just want these codes?
Comments

Freelance technical trainer / consultant (Embedded systems, Automation / Scripting) : C, Linux, Embedded systems, python, perl, tcl

Requirements can be elaborated?
Comments

Computer trainer

Upgrade yourself to C# , the C & graphics packages work only for DOS mode which is rare today. Explore the entire windowing using C#
Comments

Tutor

It's all the game of pointers in C. That is very easy task. But you looking for new job you should aware the technology.
Comments

Tutor

#include stdio.h #include conio.h #include graphics.h void main() { int gd=DETECT, gm; clrscr(); initgraph(&gd,&gm,"C:\\TurboC3\\bgi"); circle(200,200,20); circle(180,180,5); circle(220,180,5); arc(190,210,45,135,10); getch(); } copy past this code into notepad and than save it by (.c...
read more
#include stdio.h #include conio.h #include graphics.h void main() { int gd=DETECT, gm; clrscr(); initgraph(&gd,&gm,"C:\\TurboC3\\bgi"); circle(200,200,20); circle(180,180,5); circle(220,180,5); arc(190,210,45,135,10); getch(); } copy past this code into notepad and than save it by (.c extension) at C:\TurboC++\Disk\TurboC3\BIN (change in header file and used less than and greater than sign because this site not allowed this characters) Tool- Turbo c++ enjoy... read less
Comments

Advance C-Embedded

mail id please
Comments

View 6 more Answers

Related Questions

What is a stream?
Transferring data from one location to another location...
Nilam
What are the flaws of the C programming language?
The C programming language, while powerful and widely used, has some inherent flaws. One notable limitation is its lack of built-in support for dynamic memory management and bounds checking. This can lead...
Sounak
0 0
7
How can I develop my C language?
Practice coding: Write code regularly, even if it's small programs. Practice is key to improving. Read books and online tutorials: There are many resources available to learn C. Books like "The C Programming...
Mohit
0 0
5
Are C and C++ a prerequisite for learning Java?
yes..syntax of java is same as a c and c++..so it the advantage if you know any one of these.
Mrunal
0 0
5
in c : i want run time input: data=[name:raj,age:20] output: value[0]=raj value[1]=20 i want c code
Make use of Command line argument and access using argv,argc.
Vanaraj

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Everything about printf in C language
What is printf and from where it comes from in C code.? You must have used printf so many times in your Car programs but do you really know everything about printf? Let's see. What is the full form...

C Language
To get help in C window (for keywords, functions) press Alt +F1.To delete a single line , use the shortcut key CTRL +Y.If you got error about the path when you execute a C pgm, check the Options menu =>Directories.
T

Thilagam S.

0 0
0

10 Tips to improve your learning
1. Have a quick revision of topics that you have read in past three days before you start studying a new topic. 2. Make your own notes containing the summary of the topic. 3. Allot proper timing for...

Be prepared to get trained--init
Before starting the training,students must be mentally prepared for acceptance of new knowledge. Students must attend training with open minded forgetting the position they are working.This will help...
S

Smartnub Softsolutions

0 0
0

4 Things Every Tech Startup Needs to Know About The Coaching Industry
Knowledge on any subject is widely available to those who wish to learn. However, just gathering knowledge from other people doesn’t guarantee results in business. Results come from applying what...

Recommended Articles

Lasya Infotech is a Hyderabad based IT training institute founded in 2016 by O Venkat. Believing in his innovation, passion and persistence and with a diverse blend of experience, he started his brainchild to deliver exemplary professional courses to aspiring candidates by honing their skills. Ever since the institute envisions...

Read full article >

Brilliant Academy is one of the reputed institutes for B.Tech tuition classes. This institute is specialised in delivering quality tuition classes for B.E, Engineering - all streams and Engineering diploma courses. Incorporated in 2012, Brillant Academy is a brainchild of Mr Jagadeesh. The main motto of the academy is to...

Read full article >

Almost all of us, inside the pocket, bag or on the table have a mobile phone, out of which 90% of us have a smartphone. The technology is advancing rapidly. When it comes to mobile phones, people today want much more than just making phone calls and playing games on the go. People now want instant access to all their business...

Read full article >

Information technology consultancy or Information technology consulting is a specialized field in which one can set their focus on providing advisory services to business firms on finding ways to use innovations in information technology to further their business and meet the objectives of the business. Not only does...

Read full article >

Looking for C Language Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for C Language Classes?

The best tutors for C Language Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn C Language with the Best Tutors

The best Tutors for C Language Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more