SlideShare a Scribd company logo
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <graphics.h>
#include <dos.h>
/*
* calculatesthe positionforminute andsecondneedle.
* 360 to 90 degree isequivalentto45 to 0 th minute
* in clock. So, store the pointsinreverse direction(45to0)
* Once 0 is reached,we needtostore pointscorrespondsto
* 84th degree to0 degree inreverse direction(59to46). So,
* totallywe will get60 pointswhichcorrespondsto60
* minute orsecondpositioninclock.
*/
voidminSecCalc(intxrad,intmidx,intmidy,intx[60],inty[60]) {
inti,j = 45;
for(i = 360; i >= 0; i = i - 6) {
x[j] = midx - (xrad* cos((i * 3.14) / 180));
y[j--] =midy - (xrad* sin((i *3.14) / 180));
j = (j == -1) ? 59:j;
}
return;
}
/*
* findthe pointsat 0, 30, 60,.., 360 degrees
* on the givencircle. x value correpondsto
* radius* cos(angle) andyvalue corresponds
* to radius* sin(angle). Numbersinthe clock
* are writtenusingthe above manipulatedx and
* y values. Andthe hourneedle movement
* is basedon this
*/
voidcalcPoints(intradius,intmidx,intmidy,intx[12],inty[12]) {
intx1, y1;
/* 90, 270, 0, 180 degrees*/
x[0] = midx,y[0] = midy - radius;
x[6] = midx,y[6] = midy+ radius;
x[3] = midx + radius,y[3] = midy;
x[9] = midx - radius,y[9] = midy;
/* 30, 150, 210, 330 degrees*/
x1 = (int) ((radius/2) * sqrt(3));
y1 = (radius/2);
x[2] = midx + x1, y[2] = midy - y1;
x[4] = midx + x1, y[4] = midy+ y1;
x[8] = midx - x1,y[8] = midy+ y1;
x[10] = midx - x1, y[10] = midy - y1;
/* 60, 120, 210, 300 degrees*/
x1 = radius/ 2;
y1 = (int) ((radius/2) * sqrt(3));
x[1] = midx + x1, y[1] = midy - y1;
x[5] = midx + x1, y[5] = midy+ y1;
x[7] = midx - x1,y[7] = midy+ y1;
x[11] = midx - x1, y[11] = midy - y1;
return;
}
intmain() {
/* requestautodetection*/
intgdriver= DETECT, gmode,err,tmp;
inti,j, midx,midy,radius,hr,min,sec;
intx[12],y[12], minx[60],miny[60];
inthrx[12],hry[12],secx[60],secy[60];
intsecx1,secy1;
char str[256];
time_tt1;
structtm *data;
/* initialize graphicmode */
initgraph(&gdriver,&gmode,"C:/TC/BGI");
err= graphresult();
if (err!= grOk) {
/* error occurred*/
printf("GraphicsError:%s",
grapherrormsg(err));
return0;
}
/* midpositioninx andy -axis*/
midx = getmaxx()/2;
midy= getmaxy() /2;
radius= 200;
/* positiontolocate numbersinclock*/
calcPoints(radius - 30,midx,midy,x,y);
/* getspositionforhourneedle */
calcPoints(radius - 90,midx,midy,hrx,hry);
/* getspositionforminute needle*/
minSecCalc(radius - 50, midx,midy,minx,miny);
/* getspositionforsecondneedle */
minSecCalc(radius - 70, midx,midy,secx,secy);
while (!kbhit()){
setlinestyle(SOLID_LINE,1,3);
settextstyle(TRIPLEX_FONT,0,3);
/* draws frame of the clock*/
circle(midx,midy,radius);
/* place the numbers inclock*/
for (j = 0; j < 12; j++) {
if (j == 0) {
sprintf(str,"%d",12);
} else {
sprintf(str,"%d",j);
}
settextjustify(CENTER_TEXT,CENTER_TEXT);
moveto(x[j],y[j]);
outtext(str);
}
/* get the currenttime usingtime() API*/
t1 = time(NULL);
data = localtime(&t1);
/* draw the secondneedle inclock*/
sec = data->tm_sec% 60;
line(midx,midy,secx[sec],secy[sec]);
/* draw the minute needleinclock*/
min= data->tm_min%60;
line(midx,midy,minx[min],miny[min]);
/* draw the hour needle inclock*/
hr = data->tm_hour% 12;
line(midx,midy,hrx[hr],hry[hr]);
delay(1000);
cleardevice();
}
getch();
/* deallocate memoryallocatedforgraphicscreen*/
closegraph();
return0;
}

More Related Content

What's hot

Sheet 1
Sheet 1Sheet 1
Sheet 1
Ahmed Elmorsy
 
Javascript Without Javascript
Javascript Without JavascriptJavascript Without Javascript
Javascript Without Javascript
Patrick Kettner
 
Sheet 3
Sheet 3Sheet 3
Sheet 3
Ahmed Elmorsy
 
Regras diferenciacao
Regras diferenciacaoRegras diferenciacao
Regras diferenciacao
Uniengenheiros2011
 
Numerical Method Assignment
Numerical Method AssignmentNumerical Method Assignment
Numerical Method Assignment
ashikul akash
 
Statistics Cheatsheet by MIT
Statistics Cheatsheet by MITStatistics Cheatsheet by MIT
Statistics Cheatsheet by MIT
Ashish Patel
 
Cara membuat tulisan mengikuti kursor di blog
Cara membuat tulisan mengikuti kursor di blogCara membuat tulisan mengikuti kursor di blog
Cara membuat tulisan mengikuti kursor di blog
Akhmad Akbar
 
2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph
kinan keshkeh
 
Logic Design - Chapter 3: Boolean Algebra
Logic Design - Chapter 3: Boolean AlgebraLogic Design - Chapter 3: Boolean Algebra
Logic Design - Chapter 3: Boolean Algebra
Gouda Mando
 
8.2 integration by parts
8.2 integration by parts8.2 integration by parts
8.2 integration by parts
dicosmo178
 
Tabela completa de derivadas e integrais
Tabela completa de derivadas e integraisTabela completa de derivadas e integrais
Tabela completa de derivadas e integrais
Diego Rodrigues Vaz
 
Sheet 2
Sheet 2Sheet 2
Sheet 2
Ahmed Elmorsy
 
Convolution_System_Response
Convolution_System_ResponseConvolution_System_Response
Convolution_System_Response
Matthew Mobley
 
Tabela derivadas-e-integrais
Tabela derivadas-e-integraisTabela derivadas-e-integrais
Tabela derivadas-e-integrais
mariasousagomes
 
Caropro
CaroproCaropro
Caropro
daquicaro
 

What's hot (16)

Sheet 1
Sheet 1Sheet 1
Sheet 1
 
Javascript Without Javascript
Javascript Without JavascriptJavascript Without Javascript
Javascript Without Javascript
 
Sheet 3
Sheet 3Sheet 3
Sheet 3
 
Regras diferenciacao
Regras diferenciacaoRegras diferenciacao
Regras diferenciacao
 
Numerical Method Assignment
Numerical Method AssignmentNumerical Method Assignment
Numerical Method Assignment
 
Statistics Cheatsheet by MIT
Statistics Cheatsheet by MITStatistics Cheatsheet by MIT
Statistics Cheatsheet by MIT
 
Cara membuat tulisan mengikuti kursor di blog
Cara membuat tulisan mengikuti kursor di blogCara membuat tulisan mengikuti kursor di blog
Cara membuat tulisan mengikuti kursor di blog
 
2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph
 
Logic Design - Chapter 3: Boolean Algebra
Logic Design - Chapter 3: Boolean AlgebraLogic Design - Chapter 3: Boolean Algebra
Logic Design - Chapter 3: Boolean Algebra
 
8.2 integration by parts
8.2 integration by parts8.2 integration by parts
8.2 integration by parts
 
Tabela completa de derivadas e integrais
Tabela completa de derivadas e integraisTabela completa de derivadas e integrais
Tabela completa de derivadas e integrais
 
My Book
My BookMy Book
My Book
 
Sheet 2
Sheet 2Sheet 2
Sheet 2
 
Convolution_System_Response
Convolution_System_ResponseConvolution_System_Response
Convolution_System_Response
 
Tabela derivadas-e-integrais
Tabela derivadas-e-integraisTabela derivadas-e-integrais
Tabela derivadas-e-integrais
 
Caropro
CaroproCaropro
Caropro
 

Similar to Include stdio. wps office (1)

I have written the code but cannot complete the assignment please help.pdf
I have written the code but cannot complete the assignment please help.pdfI have written the code but cannot complete the assignment please help.pdf
I have written the code but cannot complete the assignment please help.pdf
shreeaadithyaacellso
 
Write Python for Speed
Write Python for SpeedWrite Python for Speed
Write Python for Speed
Yung-Yu Chen
 
Ifgqueue.h#ifndef LFGQUEUE_H #define LFGQUEUE_H#include pl.pdf
Ifgqueue.h#ifndef LFGQUEUE_H #define LFGQUEUE_H#include pl.pdfIfgqueue.h#ifndef LFGQUEUE_H #define LFGQUEUE_H#include pl.pdf
Ifgqueue.h#ifndef LFGQUEUE_H #define LFGQUEUE_H#include pl.pdf
fazilfootsteps
 
ES6(ES2015) is beautiful
ES6(ES2015) is beautifulES6(ES2015) is beautiful
ES6(ES2015) is beautiful
monikagupta18jan
 
Snake.c
Snake.cSnake.c
Snake.c
Vijay Singh
 
Advanced Search Techniques
Advanced Search TechniquesAdvanced Search Techniques
Advanced Search Techniques
Shakil Ahmed
 
Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02
Er Ritu Aggarwal
 
Rkf
RkfRkf
C Prog - Pointers
C Prog - PointersC Prog - Pointers
C Prog - Pointers
vinay arora
 
C programs
C programsC programs
#include iostream #include string #include invalidHr.h.pdf
 #include iostream #include string #include invalidHr.h.pdf #include iostream #include string #include invalidHr.h.pdf
#include iostream #include string #include invalidHr.h.pdf
APMRETAIL
 
Cs580
Cs580Cs580
Programming for Artists and Designers: Week 2
Programming for Artists and Designers: Week 2Programming for Artists and Designers: Week 2
Programming for Artists and Designers: Week 2
Tinker London
 
Programming for Artists and Designers: Week 2
Programming for Artists and Designers: Week 2Programming for Artists and Designers: Week 2
Programming for Artists and Designers: Week 2
Tinker
 
Interpolation graph c++
Interpolation graph c++Interpolation graph c++
Interpolation graph c++
rpiitcbme
 
PPS Arrays Matrix operations
PPS Arrays Matrix operationsPPS Arrays Matrix operations
PPS Arrays Matrix operations
Sreedhar Chowdam
 
fixed 3 issues. I am working on remaining.package chegg;public c.pdf
fixed 3 issues. I am working on remaining.package chegg;public c.pdffixed 3 issues. I am working on remaining.package chegg;public c.pdf
fixed 3 issues. I am working on remaining.package chegg;public c.pdf
anjanacottonmills
 
C programs
C programsC programs
C programs
Azaj Khan
 
Vcs16
Vcs16Vcs16
Senior design project code for PPG
Senior design project code for PPGSenior design project code for PPG
Senior design project code for PPG
FrankDin1
 

Similar to Include stdio. wps office (1) (20)

I have written the code but cannot complete the assignment please help.pdf
I have written the code but cannot complete the assignment please help.pdfI have written the code but cannot complete the assignment please help.pdf
I have written the code but cannot complete the assignment please help.pdf
 
Write Python for Speed
Write Python for SpeedWrite Python for Speed
Write Python for Speed
 
Ifgqueue.h#ifndef LFGQUEUE_H #define LFGQUEUE_H#include pl.pdf
Ifgqueue.h#ifndef LFGQUEUE_H #define LFGQUEUE_H#include pl.pdfIfgqueue.h#ifndef LFGQUEUE_H #define LFGQUEUE_H#include pl.pdf
Ifgqueue.h#ifndef LFGQUEUE_H #define LFGQUEUE_H#include pl.pdf
 
ES6(ES2015) is beautiful
ES6(ES2015) is beautifulES6(ES2015) is beautiful
ES6(ES2015) is beautiful
 
Snake.c
Snake.cSnake.c
Snake.c
 
Advanced Search Techniques
Advanced Search TechniquesAdvanced Search Techniques
Advanced Search Techniques
 
Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02
 
Rkf
RkfRkf
Rkf
 
C Prog - Pointers
C Prog - PointersC Prog - Pointers
C Prog - Pointers
 
C programs
C programsC programs
C programs
 
#include iostream #include string #include invalidHr.h.pdf
 #include iostream #include string #include invalidHr.h.pdf #include iostream #include string #include invalidHr.h.pdf
#include iostream #include string #include invalidHr.h.pdf
 
Cs580
Cs580Cs580
Cs580
 
Programming for Artists and Designers: Week 2
Programming for Artists and Designers: Week 2Programming for Artists and Designers: Week 2
Programming for Artists and Designers: Week 2
 
Programming for Artists and Designers: Week 2
Programming for Artists and Designers: Week 2Programming for Artists and Designers: Week 2
Programming for Artists and Designers: Week 2
 
Interpolation graph c++
Interpolation graph c++Interpolation graph c++
Interpolation graph c++
 
PPS Arrays Matrix operations
PPS Arrays Matrix operationsPPS Arrays Matrix operations
PPS Arrays Matrix operations
 
fixed 3 issues. I am working on remaining.package chegg;public c.pdf
fixed 3 issues. I am working on remaining.package chegg;public c.pdffixed 3 issues. I am working on remaining.package chegg;public c.pdf
fixed 3 issues. I am working on remaining.package chegg;public c.pdf
 
C programs
C programsC programs
C programs
 
Vcs16
Vcs16Vcs16
Vcs16
 
Senior design project code for PPG
Senior design project code for PPGSenior design project code for PPG
Senior design project code for PPG
 

Recently uploaded

Identifying Major Symptoms of Slip Disc.
 Identifying Major Symptoms of Slip Disc. Identifying Major Symptoms of Slip Disc.
Identifying Major Symptoms of Slip Disc.
Gokuldas Hospital
 
Ear and its clinical correlations By Dr. Rabia Inam Gandapore.pptx
Ear and its clinical correlations By Dr. Rabia Inam Gandapore.pptxEar and its clinical correlations By Dr. Rabia Inam Gandapore.pptx
Ear and its clinical correlations By Dr. Rabia Inam Gandapore.pptx
Dr. Rabia Inam Gandapore
 
Chapter 11 Nutrition and Chronic Diseases.pptx
Chapter 11 Nutrition and Chronic Diseases.pptxChapter 11 Nutrition and Chronic Diseases.pptx
Chapter 11 Nutrition and Chronic Diseases.pptx
Earlene McNair
 
CHEMOTHERAPY_RDP_CHAPTER 6_Anti Malarial Drugs.pdf
CHEMOTHERAPY_RDP_CHAPTER 6_Anti Malarial Drugs.pdfCHEMOTHERAPY_RDP_CHAPTER 6_Anti Malarial Drugs.pdf
CHEMOTHERAPY_RDP_CHAPTER 6_Anti Malarial Drugs.pdf
rishi2789
 
Ketone bodies and metabolism-biochemistry
Ketone bodies and metabolism-biochemistryKetone bodies and metabolism-biochemistry
Ketone bodies and metabolism-biochemistry
Dhayanithi C
 
Part II - Body Grief: Losing parts of ourselves and our identity before, duri...
Part II - Body Grief: Losing parts of ourselves and our identity before, duri...Part II - Body Grief: Losing parts of ourselves and our identity before, duri...
Part II - Body Grief: Losing parts of ourselves and our identity before, duri...
bkling
 
REGULATION FOR COMBINATION PRODUCTS AND MEDICAL DEVICES.pptx
REGULATION FOR COMBINATION PRODUCTS AND MEDICAL DEVICES.pptxREGULATION FOR COMBINATION PRODUCTS AND MEDICAL DEVICES.pptx
REGULATION FOR COMBINATION PRODUCTS AND MEDICAL DEVICES.pptx
LaniyaNasrink
 
Promoting Wellbeing - Applied Social Psychology - Psychology SuperNotes
Promoting Wellbeing - Applied Social Psychology - Psychology SuperNotesPromoting Wellbeing - Applied Social Psychology - Psychology SuperNotes
Promoting Wellbeing - Applied Social Psychology - Psychology SuperNotes
PsychoTech Services
 
Clinic ^%[+27633867063*Abortion Pills For Sale In Tembisa Central
Clinic ^%[+27633867063*Abortion Pills For Sale In Tembisa CentralClinic ^%[+27633867063*Abortion Pills For Sale In Tembisa Central
Clinic ^%[+27633867063*Abortion Pills For Sale In Tembisa Central
19various
 
Osteoporosis - Definition , Evaluation and Management .pdf
Osteoporosis - Definition , Evaluation and Management .pdfOsteoporosis - Definition , Evaluation and Management .pdf
Osteoporosis - Definition , Evaluation and Management .pdf
Jim Jacob Roy
 
TEST BANK For Community and Public Health Nursing: Evidence for Practice, 3rd...
TEST BANK For Community and Public Health Nursing: Evidence for Practice, 3rd...TEST BANK For Community and Public Health Nursing: Evidence for Practice, 3rd...
TEST BANK For Community and Public Health Nursing: Evidence for Practice, 3rd...
Donc Test
 
Hemodialysis: Chapter 4, Dialysate Circuit - Dr.Gawad
Hemodialysis: Chapter 4, Dialysate Circuit - Dr.GawadHemodialysis: Chapter 4, Dialysate Circuit - Dr.Gawad
Hemodialysis: Chapter 4, Dialysate Circuit - Dr.Gawad
NephroTube - Dr.Gawad
 
CHEMOTHERAPY_RDP_CHAPTER 4_ANTI VIRAL DRUGS.pdf
CHEMOTHERAPY_RDP_CHAPTER 4_ANTI VIRAL DRUGS.pdfCHEMOTHERAPY_RDP_CHAPTER 4_ANTI VIRAL DRUGS.pdf
CHEMOTHERAPY_RDP_CHAPTER 4_ANTI VIRAL DRUGS.pdf
rishi2789
 
8 Surprising Reasons To Meditate 40 Minutes A Day That Can Change Your Life.pptx
8 Surprising Reasons To Meditate 40 Minutes A Day That Can Change Your Life.pptx8 Surprising Reasons To Meditate 40 Minutes A Day That Can Change Your Life.pptx
8 Surprising Reasons To Meditate 40 Minutes A Day That Can Change Your Life.pptx
Holistified Wellness
 
Adhd Medication Shortage Uk - trinexpharmacy.com
Adhd Medication Shortage Uk - trinexpharmacy.comAdhd Medication Shortage Uk - trinexpharmacy.com
Adhd Medication Shortage Uk - trinexpharmacy.com
reignlana06
 
Abortion PG Seminar Power point presentation
Abortion PG Seminar Power point presentationAbortion PG Seminar Power point presentation
Abortion PG Seminar Power point presentation
AksshayaRajanbabu
 
All info about Diabetes and how to control it.
 All info about Diabetes and how to control it. All info about Diabetes and how to control it.
All info about Diabetes and how to control it.
Gokuldas Hospital
 
vonoprazan A novel drug for GERD presentation
vonoprazan A novel drug for GERD presentationvonoprazan A novel drug for GERD presentation
vonoprazan A novel drug for GERD presentation
Dr.pavithra Anandan
 
TEST BANK For Community Health Nursing A Canadian Perspective, 5th Edition by...
TEST BANK For Community Health Nursing A Canadian Perspective, 5th Edition by...TEST BANK For Community Health Nursing A Canadian Perspective, 5th Edition by...
TEST BANK For Community Health Nursing A Canadian Perspective, 5th Edition by...
Donc Test
 
CHEMOTHERAPY_RDP_CHAPTER 3_ANTIFUNGAL AGENT.pdf
CHEMOTHERAPY_RDP_CHAPTER 3_ANTIFUNGAL AGENT.pdfCHEMOTHERAPY_RDP_CHAPTER 3_ANTIFUNGAL AGENT.pdf
CHEMOTHERAPY_RDP_CHAPTER 3_ANTIFUNGAL AGENT.pdf
rishi2789
 

Recently uploaded (20)

Identifying Major Symptoms of Slip Disc.
 Identifying Major Symptoms of Slip Disc. Identifying Major Symptoms of Slip Disc.
Identifying Major Symptoms of Slip Disc.
 
Ear and its clinical correlations By Dr. Rabia Inam Gandapore.pptx
Ear and its clinical correlations By Dr. Rabia Inam Gandapore.pptxEar and its clinical correlations By Dr. Rabia Inam Gandapore.pptx
Ear and its clinical correlations By Dr. Rabia Inam Gandapore.pptx
 
Chapter 11 Nutrition and Chronic Diseases.pptx
Chapter 11 Nutrition and Chronic Diseases.pptxChapter 11 Nutrition and Chronic Diseases.pptx
Chapter 11 Nutrition and Chronic Diseases.pptx
 
CHEMOTHERAPY_RDP_CHAPTER 6_Anti Malarial Drugs.pdf
CHEMOTHERAPY_RDP_CHAPTER 6_Anti Malarial Drugs.pdfCHEMOTHERAPY_RDP_CHAPTER 6_Anti Malarial Drugs.pdf
CHEMOTHERAPY_RDP_CHAPTER 6_Anti Malarial Drugs.pdf
 
Ketone bodies and metabolism-biochemistry
Ketone bodies and metabolism-biochemistryKetone bodies and metabolism-biochemistry
Ketone bodies and metabolism-biochemistry
 
Part II - Body Grief: Losing parts of ourselves and our identity before, duri...
Part II - Body Grief: Losing parts of ourselves and our identity before, duri...Part II - Body Grief: Losing parts of ourselves and our identity before, duri...
Part II - Body Grief: Losing parts of ourselves and our identity before, duri...
 
REGULATION FOR COMBINATION PRODUCTS AND MEDICAL DEVICES.pptx
REGULATION FOR COMBINATION PRODUCTS AND MEDICAL DEVICES.pptxREGULATION FOR COMBINATION PRODUCTS AND MEDICAL DEVICES.pptx
REGULATION FOR COMBINATION PRODUCTS AND MEDICAL DEVICES.pptx
 
Promoting Wellbeing - Applied Social Psychology - Psychology SuperNotes
Promoting Wellbeing - Applied Social Psychology - Psychology SuperNotesPromoting Wellbeing - Applied Social Psychology - Psychology SuperNotes
Promoting Wellbeing - Applied Social Psychology - Psychology SuperNotes
 
Clinic ^%[+27633867063*Abortion Pills For Sale In Tembisa Central
Clinic ^%[+27633867063*Abortion Pills For Sale In Tembisa CentralClinic ^%[+27633867063*Abortion Pills For Sale In Tembisa Central
Clinic ^%[+27633867063*Abortion Pills For Sale In Tembisa Central
 
Osteoporosis - Definition , Evaluation and Management .pdf
Osteoporosis - Definition , Evaluation and Management .pdfOsteoporosis - Definition , Evaluation and Management .pdf
Osteoporosis - Definition , Evaluation and Management .pdf
 
TEST BANK For Community and Public Health Nursing: Evidence for Practice, 3rd...
TEST BANK For Community and Public Health Nursing: Evidence for Practice, 3rd...TEST BANK For Community and Public Health Nursing: Evidence for Practice, 3rd...
TEST BANK For Community and Public Health Nursing: Evidence for Practice, 3rd...
 
Hemodialysis: Chapter 4, Dialysate Circuit - Dr.Gawad
Hemodialysis: Chapter 4, Dialysate Circuit - Dr.GawadHemodialysis: Chapter 4, Dialysate Circuit - Dr.Gawad
Hemodialysis: Chapter 4, Dialysate Circuit - Dr.Gawad
 
CHEMOTHERAPY_RDP_CHAPTER 4_ANTI VIRAL DRUGS.pdf
CHEMOTHERAPY_RDP_CHAPTER 4_ANTI VIRAL DRUGS.pdfCHEMOTHERAPY_RDP_CHAPTER 4_ANTI VIRAL DRUGS.pdf
CHEMOTHERAPY_RDP_CHAPTER 4_ANTI VIRAL DRUGS.pdf
 
8 Surprising Reasons To Meditate 40 Minutes A Day That Can Change Your Life.pptx
8 Surprising Reasons To Meditate 40 Minutes A Day That Can Change Your Life.pptx8 Surprising Reasons To Meditate 40 Minutes A Day That Can Change Your Life.pptx
8 Surprising Reasons To Meditate 40 Minutes A Day That Can Change Your Life.pptx
 
Adhd Medication Shortage Uk - trinexpharmacy.com
Adhd Medication Shortage Uk - trinexpharmacy.comAdhd Medication Shortage Uk - trinexpharmacy.com
Adhd Medication Shortage Uk - trinexpharmacy.com
 
Abortion PG Seminar Power point presentation
Abortion PG Seminar Power point presentationAbortion PG Seminar Power point presentation
Abortion PG Seminar Power point presentation
 
All info about Diabetes and how to control it.
 All info about Diabetes and how to control it. All info about Diabetes and how to control it.
All info about Diabetes and how to control it.
 
vonoprazan A novel drug for GERD presentation
vonoprazan A novel drug for GERD presentationvonoprazan A novel drug for GERD presentation
vonoprazan A novel drug for GERD presentation
 
TEST BANK For Community Health Nursing A Canadian Perspective, 5th Edition by...
TEST BANK For Community Health Nursing A Canadian Perspective, 5th Edition by...TEST BANK For Community Health Nursing A Canadian Perspective, 5th Edition by...
TEST BANK For Community Health Nursing A Canadian Perspective, 5th Edition by...
 
CHEMOTHERAPY_RDP_CHAPTER 3_ANTIFUNGAL AGENT.pdf
CHEMOTHERAPY_RDP_CHAPTER 3_ANTIFUNGAL AGENT.pdfCHEMOTHERAPY_RDP_CHAPTER 3_ANTIFUNGAL AGENT.pdf
CHEMOTHERAPY_RDP_CHAPTER 3_ANTIFUNGAL AGENT.pdf
 

Include stdio. wps office (1)

  • 1. #include <stdio.h> #include <conio.h> #include <string.h> #include <math.h> #include <time.h> #include <graphics.h> #include <dos.h> /* * calculatesthe positionforminute andsecondneedle. * 360 to 90 degree isequivalentto45 to 0 th minute * in clock. So, store the pointsinreverse direction(45to0) * Once 0 is reached,we needtostore pointscorrespondsto * 84th degree to0 degree inreverse direction(59to46). So, * totallywe will get60 pointswhichcorrespondsto60 * minute orsecondpositioninclock. */ voidminSecCalc(intxrad,intmidx,intmidy,intx[60],inty[60]) { inti,j = 45; for(i = 360; i >= 0; i = i - 6) { x[j] = midx - (xrad* cos((i * 3.14) / 180)); y[j--] =midy - (xrad* sin((i *3.14) / 180)); j = (j == -1) ? 59:j; }
  • 2. return; } /* * findthe pointsat 0, 30, 60,.., 360 degrees * on the givencircle. x value correpondsto * radius* cos(angle) andyvalue corresponds * to radius* sin(angle). Numbersinthe clock * are writtenusingthe above manipulatedx and * y values. Andthe hourneedle movement * is basedon this */ voidcalcPoints(intradius,intmidx,intmidy,intx[12],inty[12]) { intx1, y1; /* 90, 270, 0, 180 degrees*/ x[0] = midx,y[0] = midy - radius; x[6] = midx,y[6] = midy+ radius; x[3] = midx + radius,y[3] = midy; x[9] = midx - radius,y[9] = midy; /* 30, 150, 210, 330 degrees*/ x1 = (int) ((radius/2) * sqrt(3)); y1 = (radius/2);
  • 3. x[2] = midx + x1, y[2] = midy - y1; x[4] = midx + x1, y[4] = midy+ y1; x[8] = midx - x1,y[8] = midy+ y1; x[10] = midx - x1, y[10] = midy - y1; /* 60, 120, 210, 300 degrees*/ x1 = radius/ 2; y1 = (int) ((radius/2) * sqrt(3)); x[1] = midx + x1, y[1] = midy - y1; x[5] = midx + x1, y[5] = midy+ y1; x[7] = midx - x1,y[7] = midy+ y1; x[11] = midx - x1, y[11] = midy - y1; return; } intmain() { /* requestautodetection*/ intgdriver= DETECT, gmode,err,tmp; inti,j, midx,midy,radius,hr,min,sec; intx[12],y[12], minx[60],miny[60]; inthrx[12],hry[12],secx[60],secy[60]; intsecx1,secy1; char str[256]; time_tt1;
  • 4. structtm *data; /* initialize graphicmode */ initgraph(&gdriver,&gmode,"C:/TC/BGI"); err= graphresult(); if (err!= grOk) { /* error occurred*/ printf("GraphicsError:%s", grapherrormsg(err)); return0; } /* midpositioninx andy -axis*/ midx = getmaxx()/2; midy= getmaxy() /2; radius= 200; /* positiontolocate numbersinclock*/ calcPoints(radius - 30,midx,midy,x,y); /* getspositionforhourneedle */ calcPoints(radius - 90,midx,midy,hrx,hry);
  • 5. /* getspositionforminute needle*/ minSecCalc(radius - 50, midx,midy,minx,miny); /* getspositionforsecondneedle */ minSecCalc(radius - 70, midx,midy,secx,secy); while (!kbhit()){ setlinestyle(SOLID_LINE,1,3); settextstyle(TRIPLEX_FONT,0,3); /* draws frame of the clock*/ circle(midx,midy,radius); /* place the numbers inclock*/ for (j = 0; j < 12; j++) { if (j == 0) { sprintf(str,"%d",12); } else { sprintf(str,"%d",j); } settextjustify(CENTER_TEXT,CENTER_TEXT); moveto(x[j],y[j]); outtext(str); }
  • 6. /* get the currenttime usingtime() API*/ t1 = time(NULL); data = localtime(&t1); /* draw the secondneedle inclock*/ sec = data->tm_sec% 60; line(midx,midy,secx[sec],secy[sec]); /* draw the minute needleinclock*/ min= data->tm_min%60; line(midx,midy,minx[min],miny[min]); /* draw the hour needle inclock*/ hr = data->tm_hour% 12; line(midx,midy,hrx[hr],hry[hr]); delay(1000); cleardevice(); } getch(); /* deallocate memoryallocatedforgraphicscreen*/ closegraph(); return0; }