Develop a program in 'C' Analog and digital clock Computer Graphics project

Develop a program in 'C' Analog and digital clock Computer Graphics project


⭕ Micro-Project - Develop a program in 'C' Analog and digital clock Computer Graphics project ⭕


1.0             Brief Introduction

                The mini-project “Analog and digital clock project in C” is a console application using the C programming language An analog clock is a tool for reading the time of day. The shortest hand indicates the hour, a longer hand indicates the minutes, and the longest arm indicates the seconds. Some analog clocks have only two hands: the shorter hand indicating the hour and the longer hand indicating the minutes.

A clock or watch is called "analog" when it has moving hands and (usually) hours marked from 1 to 12 to show you the time. Some have Roman Numerals (I, II, III, etc) instead, or no numbers at all! In other words: not a digital clock.

A digital clock is a type of clock that displays the time digitally numerals or other symbols, as opposed to an   analog clock, where the time is indicated by the positions of rotating   hands.


2.0             Aim of the Micro-Project

Develop a program in 'C' Analog and digital clock Computer Graphics


3.0             Intended Course Outcomes

1.      Develop programs for 2-D and 3-D transformations.

2.      Use projection to visualize objects on view plane.

3.      Implement various clipping algorithms.

4.      Develop programs to create curves using algorithms.

5.      Manipulate visual and geometric information of images.

6.      Implement standard algorithms to draw various graphics object using c program.

        Literature Review

Most of the research and writings on analog and digital clock. The Project is idea to display the clock with computer graphics. This project just used the local time, fetching from the computer and display it on screen. This project implements the wall clock with the round circular board and three conic geometrics which forms the different (sec, min & hour) hands. Small cubes are also made for the minutes, while each hour is represented with a large block. Digit display of the clock timing is also placed at the left.

This Function Use in Project

main()-The first lines in main are graphic initialization, you must change the path “c:\turboc3\bgi\” to your compiler’s BGI file path otherwise program will not work.This program is like getting the static picture of clock every second and combining all the pictures to make a moving analog clock and show digital clock in number.

getmaxx()-The header file graphics.h contains getmaxx() function which returns the maximum X coordinate for current graphics mode and driver.

getmaxy()-The header file graphics.h contains getmaxy() function which returns the maximum Y coordinate for current graphics mode and driver.

settextstyle()-

The header file graphics.h contains settextstyle() function which is used to change the way in which text appears. Using it we can modify the size of text, change direction of text and change the font of text.

outtextxy()-The header file graphics.h contains outtextxy() function which displays the text or string at a specified point (x, y) on the screen.

cleardevice()-The header file graphics.h contains cleardevice() function which clears the screen in graphics mode and sets the current position to (0,0). Clearing the screen consists of filling the screen with current background color.

settextstyle()-The header file graphics.h contains settextstyle() function which is used to change the way in which text appears. Using it we can modify the size of text, change direction of text and change the font of text.

closegraph()-The header file graphics.h contains closegraph() function which closes the graphics mode, deallocates all memory allocated by graphics system and restores the screen to the mode it was in before you called initgraph.

Here, we are going to develop the Analog and Digital clock in computer graphics. In this, we will tell how to make a clock by using functions to display time. The programming language is used here is C.

The main theme of this project is as follows:

–> It is Interactive 2D graphics.

–> The clock will be displayed.

–> Time will be displayed as same as system time.

A clock or watch is A clock or watch is called "analog"  when it has moving hands when it has moving hands and hours marked and hours marked from 1 to 12 to show you the time. Analog  clocks usually indicate time using angles. The most common clock face uses a fixed numbered uses dial or dials and moving hand. 

This project shows the graphical representation of a working analogue and digital clock. The objective of this program is to implement simple and basic functions of graphics. Computer graphics plays a major role in today’s world where visualization takes the upper hand as compared to textual interaction. This is largely true as we can see user interface becoming more and more attractive all thanks to major leaps in the fields of computer graphics. The project is implemented using graphics provided by C. The above argument is equally justified in the fields of computer simulation which involve complex graphics being highlighted at its peak. It is becoming more and more popular and the constant dive to improve particular system efficiency by studying its simulated model attracts more people towards it.

                          Proposed Methodology

An information In this Project we have learned To create an analog and digital clock in C Language using computer graphics. This Function use In Micro Project

main()-The first lines in main are graphic initialization, you must change the path “c:\turboc3\bgi\” to your compiler’s BGI file path otherwise program will not  work. This program is like getting the static picture of clock every second and combining all the pictures to make a moving analog clock and show digital clock in number.

getmaxx()-The header file graphics.h contains getmaxx() function which returns the maximum X coordinate for current graphics mode and driver.

getmaxy()-The header file graphics.h contains getmaxy() function which returns the maximum Y coordinate for current graphics mode and driver.

settextstyle()- The header file graphics.h contains settextstyle() function which is used to change the way in which text appears. Using it we can modify the size of text, change direction of text and change the font of text.

outtextxy()-The header file graphics.h contains outtextxy() function which displays the text or string at a specified point (x, y) on the screen.

cleardevice()-The header file graphics.h contains cleardevice() function which clears the screen in graphics mode and sets the current position to (0,0). Clearing the screen consists of filling the screen with current background color.

settextstyle()-The header file graphics.h contains settextstyle() function which is used to change the way in which text appears. Using it we can modify the size of text, change direction of text and change the font of text.

closegraph()-The header file graphics.h contains closegraph() function which closes the graphics mode, deallocates all memory allocated by graphics system and restores the screen to the mode it was in before you called initgraph.

 

6.0             Resources Required

 

Laptop ---> Core i5 -2.3 GHz  8 GB Ram 64-bit operating system

Software ---> C/C++ Turbo

___________________________________________________________________________________

Micro-Project Report

Develop a program in 'C' Analog and digital clock Computer Graphics


Rationale

            A digital clock is a type of clock that displays the time digitally (i.e. in numerals or other symbols), as opposed to an analogue clock. Digital clocks are often associated with electronic drives, but the "digital" description refers only to the display, not to the drive mechanism. (Both analogue and digital clocks can be driven either mechanically or electronically, but "clockwork" mechanisms with digital displays are rare). Because digital clocks can be very small and inexpensive devices that enhance the popularity of product designs, they are often incorporated into all kinds of devices such as cars, radios, televisions, microwave ovens, standard ovens, computers and cell phones. Sometimes their usefulness is disputed: a common complaint is that when time has to be set to Daylight Saving Time, many household clocks have to be readjusted. The incorporation of automatic synchronization by a radio time signal is reducing this problem (see Radio clock).

A clock is a device used to measure, keep, and indicate time. The clock is one of the oldest human inventions, meeting the need to measure intervals of time shorter than the natural units: the day, the lunar month, and the year. Devices operating on several physical processes have been used over the millennia.

 

 

Course Outcomes Addressed


1.      Develop programs for 2-D and 3-D transformations.

2.      Use projection to visualize objects on view plane.

3.      Implement various clipping algorithms.

4.      Develop programs to create curves using algorithms.

5.      Manipulate visual and geometric information of images.

6.      Implement standard algorithms to draw various graphics object using c program.

 

  Literature Review

Most of the research and writings on Most of the research and writings on analog and digital clock. The Project is idea to display the clock with computer graphics. This project just used the local time, fetching from the computer and display it on screen. 

This project implements the wall clock with the round circular board and three conic geometrics which forms the different (sec, min & hour) hands. Small cubes are also made for the minutes, while each hour is represented with a large block. Digit display of the clock timing is also placed at the left.

This Function Use in Project :

main()-The first lines in main are graphic initialization, you must change the path “c:\turboc3\bgi\” to your compiler’s BGI file path otherwise program will not work.This program is like getting the static picture of clock every second and combining all the pictures to make a moving analog clock and show digital clock in number.

getmaxx()-The header file graphics.h contains getmaxx() function which returns the maximum X coordinate for current graphics mode and driver.

getmaxy()-The header file graphics.h contains getmaxy() function which returns the maximum Y coordinate for current graphics mode and driver.

settextstyle()-The header file graphics.h contains settextstyle() function which is used to change the way in which text appears. Using it we can modify the size of text, change direction of text and change the font of text.

outtextxy()-The header file graphics.h contains outtextxy() function which displays the text or string at a specified point (x, y) on the screen.

cleardevice()-The header file graphics.h contains cleardevice() function which clears the screen in graphics mode and sets the current position to (0,0). Clearing the screen consists of filling the screen with current background color.

settextstyle()-The header file graphics.h contains settextstyle() function which is used to change the way in which text appears. Using it we can modify the size of text, change direction of text and change the font of text.

closegraph()-The header file graphics.h contains closegraph() function which closes the graphics mode, deallocates all memory allocated by graphics system and restores the screen to the mode it was in before you called initgraph. Here, we are going to develop the Analog and Digital clock in computer graphics. In this, we will tell how to make a clock by using functions to display time. The programming language is used here is C. The main theme of this project is as follows:

–> It is Interactive 2D graphics.

–> The clock will be displayed.

–> Time will be displayed as same as system time.

A clock or watch is A clock or watch is called "analog"  when it has moving hands when it has moving hands and hours marked and hours marked from 1 to 12 to show you the time. Analog  clocks usually indicate time using angles. The most common clock face uses a fixed numbered uses dial or dials and moving hand. 

This project shows the graphical representation of a working analogue and digital clock. The objective of this program is to implement simple and basic functions of graphics. Computer graphics plays a major role in today’s world where visualization takes the upper hand as compared to textual interaction. This is largely true as we can see user interface becoming more and more attractive all thanks to major leaps in the fields of computer graphics. The project is implemented using graphics provided by C. The above argument is equally justified in the fields of computer simulation which involve complex graphics being highlighted at its peak. It is becoming more and more popular and the constant dive to improve particular system efficiency by studying its simulated model attracts more people towards it.


7.0             Actual Methodology Followed

            An information In this Project we have learned To create an analog and digital clock in C Language using computer graphics. This Function use In Micro Project main()-The first lines in main are graphic initialization, you must change the path “c:\turboc3\bgi\” to your compiler’s BGI file path otherwise program will not work. This program is like getting the static picture of clock every second and combining all the pictures to make a moving analog clock and show digital clock in number.

 

 

  Actual Resources Used



Laptop ---> Core i5 -2.3 GHz  8 GB Ram 64-bit operating system

Software ---> C/C++ Turbo


8.0            Program


#include<stdio.h>

#include<conio.h>

#include<math.h>

#include<graphics.h>

#include<dos.h>

void main()

 

{

 

 int gd=DETECT,gm,i,y,x,s,m,h,l;

 float pi=3.14;

 initgraph(&gd,&gm,"c:\\TURBOC3\\BGI");

 x=getmaxx()/2;

 y=getmaxy()/2;

settextstyle(3,0,3);

 outtextxy(x-100,y-100,"DIGITAL AND ANALOG CLOCK");

 getch();

 printf("\n Digital And Analog Clock");

 printf("\n Set Time:- \n");

 printf(" Hour:- ");

 scanf("%d",&h);

 printf(" Minute:- ");

 scanf("%d",&m);

 printf(" Second:- ");

 scanf("%d",&s);

printf(" till:- ");    //how many the clock is to be display

 scanf("%d",&l);

 cleardevice();

 settextstyle(1,0,1);

 for(i=0;i<l;i++)

 {

  //clock//

  circle(x,y,200);

  circle(x,y,199);

 

line(x,y-200,x,y-180);

line(x,y+200,x,y+180);

line(x-200,y,x-180,y);

line(x+200,y,x+180,y);

  if(s==60)

  {

   s=0;

   m++;

  }

  if(m==60)

  {

   m=0;

   h++;

  } 

line(x,y,x+75*sin(h*pi/6),y-75*cos(h*pi/6));  //hour hand //

 line(x,y,x+150*sin(m*pi/30),y-150*cos(m*pi/30));        

 //min hand //

  line(x,y,x+175*sin(s*pi/30),y-150*cos(s*pi/30)); 

//sec. hand //

  printf("%d:%d:%d:",h,m,s);

  s++;

  delay(1000);

printf("\b\b\b\b\b\b\b\b");

 cleardevice();

 }

 

 getch();

 closegraph();

}

 

  Outputs of the Micro-Project

 

Develop a program in 'C' Analog and digital clock Computer Graphics project


 Skill Developed / learning out of this Micro-Project

           

·        Technical Skills: ...

·        Communication Skills: ...

·        Problem Solving Skills: ...

·        Decision Making Skills: ...

·        Leadership Skills: ...

·        Performance Skills: ...

·        Team Building Skills: ...

 

 

**************