├── .gitignore ├── Analog Clock └── Analog_Clock.cpp ├── Digital Clock └── digital_Clock.cpp ├── Picture ├── Digital Clock.PNG ├── analog_clock.png ├── propose-1.png └── propose-2.png ├── Propose Girl └── proposed-girl.cpp └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.exe 2 | *.o -------------------------------------------------------------------------------- /Analog Clock/Analog_Clock.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | int midx,midy,radious,dradious,sradious; 6 | int secminx[60],secminy[60]; 7 | //hour can't be more than 12 but 8 | // when hour is 1 and min is 20 then hour stick should be on 1.2 9 | //that's why we store all avialable storage 10 | int hourx[60],houry[60]; 11 | int designx[60],designy[60]; 12 | int minitx[60],minity[60]; 13 | char str[10]; 14 | //here we set the value 15 | void settingup() 16 | { 17 | midx=getmaxx()/2; 18 | midy=getmaxy()/2; 19 | radious=180; 20 | dradious=radious+10; 21 | sradious=radious-18; 22 | } 23 | //firt we store all Coordinate 24 | void secmin() 25 | { 26 | int j=45; 27 | for(int i=0; i<=360; i+=6) 28 | { 29 | //hour Coordinate storing 30 | hourx[j]=midx-( (sradious-60) *cos(i*3.14 / 180)); 31 | houry[j]=midy-( (sradious-60)*sin(i*3.14 / 180)); 32 | //storing design Coordinate 33 | designx[j]=midx-round( dradious*cos(i*3.14 / 180)); 34 | designy[j]=midy-round(dradious*sin(i*3.14 / 180)); 35 | //storing minutes 36 | minitx[j]=midx-round((sradious-35)*cos(i*3.14 / 180)); 37 | minity[j]=midy-round((sradious-35)*sin(i*3.14 / 180)); 38 | //for storing second Coordinate 39 | secminx[j]=midx-round(sradious*cos(i*3.14 / 180)); 40 | secminy[j++]=midy-round(sradious*sin(i*3.14 / 180)); 41 | 42 | j= j==60 ? 0 : j; 43 | } 44 | 45 | } 46 | // this function will show all the hour 47 | //and upper circle of the watch which used for designing 48 | void customizing() 49 | { 50 | 51 | for(int i=0; i<60; i++) 52 | { 53 | if(!(i%5)) 54 | { 55 | 56 | sprintf(str,"%d",i/5 ==0 ? 12:i/5 ); 57 | outtextxy(secminx[i],secminy[i],str); 58 | } 59 | circle(designx[i],designy[i],10); 60 | 61 | } 62 | 63 | } 64 | //this function is used to create sec stick 65 | void secstick(int x,int y) 66 | { 67 | setcolor(GREEN); 68 | line(midx,midy,secminx[x],secminy[y]); 69 | } 70 | //this function is used to create hour stick 71 | void hourstick(int x,int y) 72 | { 73 | setcolor(RED); 74 | //here we add minutes with hour 75 | int k=(x*5)+(y/10); 76 | 77 | line(midx,midy,hourx[k],houry[k]); 78 | 79 | } 80 | //this function is used to create min stick 81 | void minstick(int x,int y) 82 | { 83 | setcolor(3); 84 | line(midx,midy,minitx[x],minity[x]); 85 | 86 | } 87 | int main() 88 | { 89 | int gd=DETECT,gm; 90 | initgraph(&gd,&gm,""); 91 | //setting up all value 92 | settingup(); 93 | 94 | time_t t1; 95 | struct tm *data; 96 | //used to sotore all Coordinate value 97 | secmin(); 98 | while(!kbhit()) 99 | { 100 | //getting time from device 101 | t1=time(NULL); 102 | data=localtime(&t1); 103 | 104 | //clearing screen 105 | cleardevice(); 106 | setcolor(YELLOW); 107 | //circle 108 | circle(midx,midy,radious); 109 | circle(midx,midy,radious+20); 110 | //printing all hour and design circle 111 | customizing(); 112 | //printing sec stick 113 | secstick(data->tm_sec,data->tm_sec); 114 | //printing hour stick 115 | hourstick(data->tm_hour%12,data->tm_min); 116 | //printing min stick 117 | minstick(data->tm_min,data->tm_min); 118 | //timer for 1 second 119 | Sleep(1000); 120 | } 121 | 122 | getch(); 123 | closegraph(); 124 | 125 | return 0; 126 | } 127 | -------------------------------------------------------------------------------- /Digital Clock/digital_Clock.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main() 4 | { 5 | int gd,gm; 6 | gd=DETECT; 7 | initgraph(&gd,&gm,""); 8 | 9 | //used for getting graph height and width 10 | int midx=getmaxx()/4; 11 | int midy=getmaxy()/4; 12 | //used for taking current time 13 | time_t t1; 14 | struct tm *data; 15 | char str[100]; 16 | // loop will be run untill we press keyboard 17 | while(!kbhit()) 18 | { 19 | line(0,midy-20,midx*4,midy-20); 20 | line(0,midy*2,midx*4,midy*2); 21 | //storing local time in data 22 | t1=time(NULL); 23 | data=localtime(&t1); 24 | 25 | //used for convert different value to string 26 | strftime(str,100,"%I : %M : %S",data); 27 | //color set 28 | setcolor(14); 29 | //changing font and it's size 30 | settextstyle(SANS_SERIF_FONT,0,7); 31 | //printing str in graph 32 | outtextxy(midx,midy,str); 33 | //used for convert different value to string 34 | strftime(str,100,"%p",data); 35 | //changing font and it's size 36 | settextstyle(SANS_SERIF_FONT,0,2); 37 | //printing str in graph 38 | outtextxy(midx+315,midy+10,str); 39 | //converting date to string 40 | strftime(str,100,"%a , %d %b 20%y",data); 41 | //changing font and it's size 42 | setcolor(11); 43 | settextstyle(SANS_SERIF_FONT,0,4); 44 | //printing str in graph 45 | outtextxy(midx+10,midy*1.5,str); 46 | //timer for 1 second 47 | Sleep(1000); 48 | //clearing screen 49 | cleardevice(); 50 | } 51 | getch(); 52 | closegraph(); 53 | 54 | return 0; 55 | } 56 | 57 | -------------------------------------------------------------------------------- /Picture/Digital Clock.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grim-firefly/C-CPP-Project/6b4d8624b8e98a4ab249e36604b883f92ebdfbeb/Picture/Digital Clock.PNG -------------------------------------------------------------------------------- /Picture/analog_clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grim-firefly/C-CPP-Project/6b4d8624b8e98a4ab249e36604b883f92ebdfbeb/Picture/analog_clock.png -------------------------------------------------------------------------------- /Picture/propose-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grim-firefly/C-CPP-Project/6b4d8624b8e98a4ab249e36604b883f92ebdfbeb/Picture/propose-1.png -------------------------------------------------------------------------------- /Picture/propose-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grim-firefly/C-CPP-Project/6b4d8624b8e98a4ab249e36604b883f92ebdfbeb/Picture/propose-2.png -------------------------------------------------------------------------------- /Propose Girl/proposed-girl.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int midx,midy; 4 | int midx3_2,midy3_2; 5 | void downline() 6 | { 7 | setlinestyle(0,0,3); 8 | line(0,midy3_2,midx*2,midy3_2); 9 | setlinestyle(0,0,1); 10 | } 11 | void girl() 12 | { 13 | setcolor(WHITE); 14 | setfillstyle(SOLID_FILL,5); 15 | //woman belly 16 | line(midx3_2,midy3_2-20,midx3_2+20,midy3_2-20); 17 | line(midx3_2,midy3_2-20,midx3_2+10,midy3_2-50); 18 | line(midx3_2+20,midy3_2-20,midx3_2+10,midy3_2-50); 19 | floodfill(midx3_2+10,midy3_2-21,WHITE); 20 | //woman leg 21 | line(midx3_2+5,midy3_2-20,midx3_2+3,midy3_2); 22 | line(midx3_2+15,midy3_2-20,midx3_2+15,midy3_2); 23 | //woman chest 24 | line(midx3_2+10,midy3_2-70,midx3_2+10,midy3_2-50); 25 | line(midx3_2+10,midy3_2-50,midx3_2,midy3_2-60); 26 | line(midx3_2+10,midy3_2-50,midx3_2+20,midy3_2-60); 27 | line(midx3_2,midy3_2-60,midx3_2+10,midy3_2-70); 28 | line(midx3_2+20,midy3_2-60,midx3_2+10,midy3_2-70); 29 | //woman face 30 | circle(midx3_2+10,midy3_2-82,12); 31 | //woman eye 32 | circle(midx3_2+4,midy3_2-85,3); 33 | circle(midx3_2+15,midy3_2-85,3); 34 | line(midx3_2+8,midy3_2-76,midx3_2+12,midy3_2-76); 35 | //woman hair 36 | 37 | line(midx3_2-5,midy3_2-70,midx3_2+25,midy3_2-70); 38 | ellipse(midx3_2+10,midy3_2-80,-25,205,17,23); 39 | 40 | 41 | 42 | } 43 | void man(int i,int spedd) 44 | { 45 | // man face 46 | circle(20+i,midy3_2-90,12); 47 | //man eye 48 | circle(25+i,midy3_2-93,3); 49 | //man mouth 50 | line(24+i,midy3_2-86,27+i,midy3_2-86); 51 | // man chest 52 | line(20+i,midy3_2-30,20+i,midy3_2-78); 53 | //man hand 54 | line(30+i,midy3_2-60,20+i,midy3_2-78); 55 | line(30+i,midy3_2-60,40+i,midy3_2-68); 56 | line(40+i,midy3_2-68,40+i,midy3_2-78); 57 | //flower 58 | circle(40+i,midy3_2-80,3); 59 | circle(44+i,midy3_2-80,3); 60 | circle(36+i,midy3_2-80,3); 61 | circle(40+i,midy3_2-83,3); 62 | // man leg 63 | line(20+i,midy3_2-30,12+i+spedd,midy3_2); 64 | line(20+i,midy3_2-30,28+i-spedd,midy3_2); 65 | 66 | } 67 | void textandheart(int i) 68 | { 69 | //massage 70 | setcolor(3); 71 | outtextxy(midx3_2-70,midy3_2-160,"I LOVE YOU :) "); 72 | setcolor(4); 73 | ellipse(midx3_2-25,midy3_2-155,0,360,70,24); 74 | line(25+i,midy3_2-100,midx3_2-30,midy3_2-130); 75 | setcolor(WHITE); 76 | //heart 77 | setfillstyle(SOLID_FILL,RED); 78 | arc(i+60,midy3_2-100,0,180,5); 79 | arc(i+70,midy3_2-100,0,180,5); 80 | line(i+60+5,midy3_2-90,i+55,midy3_2-100); 81 | line(i+60+5,midy3_2-90,i+75,midy3_2-100); 82 | floodfill(i+60+1,midy3_2-100,WHITE); 83 | setcolor(WHITE); 84 | 85 | } 86 | int main() 87 | { 88 | int gd=DETECT,gm; 89 | initgraph(&gd,&gm,""); 90 | midx=getmaxx()/2; 91 | midy=getmaxy()/2; 92 | midx3_2=midx+midx/2; 93 | midy3_2=midy+midy/2; 94 | downline(); 95 | girl(); 96 | int spedd=0; 97 | int i; 98 | for(i=0; i<=midx3_2-100; i++) 99 | { 100 | 101 | cleardevice(); 102 | downline(); 103 | girl(); 104 | man(i,spedd); 105 | spedd+=1; 106 | spedd*= spedd >5 ? -1: 1; 107 | 108 | Sleep(50); 109 | 110 | } 111 | textandheart(i); 112 | getch(); 113 | closegraph(); 114 | return 0; 115 | } 116 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # C-CPP-Project 2 | Here You will find some easy C and C++ project. 3 | 4 | To Run the code you firstly need to add graphic.h header file in your compiler. 5 | then Run the code. Else you will get compilation Error. 6 | 7 |

1.Digital Clock

8 |

when you run the program... your clock will look like this.

9 | 10 |















11 |

2.Analog Clock

12 |

when you run the program... your clock will look like this.

13 | 14 |
15 | 16 |















17 |

3.Propose Girls

18 |
19 |

Here a man will walk and propose a girl

20 | 21 |















22 | 23 | 24 | --------------------------------------------------------------------------------