Search This Blog
Subjects Lists
Friday, October 1, 2021
red fort drawing in c program source code | lal kila drawing
//___________WELCOME ALL OF YOU ON ROHIT TECH STUDY CHANNEL________________//
//________________C++ PROGRAM TO DRAW THE RED FORT_______________________//
#include<conio.h>
#include<dos.h>
#include<stdlib.h>
#include<graphics.h>
#include<iostream.h>
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\tc\\bgi");
setcolor(12);
line(30,450,600,450);
line(0,440,30,450);
line(650,436,600,450);
line(30,430,600,430);
line(0,420,30,430);
line(650,416,600,430);
line(30,410,600,410);
line(0,400,30,410);
line(650,400,600,410);
line(30,410,30,450);
line(600,410,600,450);
line(593,410,593,450);
line(37,410,37,450);
rectangle(40,215,590,370);
rectangle(200,215,410,370);
line(200,221,410,221);
line(200,227,410,227);
rectangle(210,250,400,260);
rectangle(213,260,397,370);
rectangle(235,270,290,367);
rectangle(310,270,370,367);
line(40,260,200,260);
line(40,265,200,265);
line(92,265,92,370);
line(148,265,148,370);
line(46,297,46,370);
line(46,297,66,266);
line(87,297,87,370);
line(87,297,64,266);
line(98,297,98,370);
line(98,297,118,266);
line(142,297,142,370);
line(142,297,118,266);
line(154,297,154,370);
line(154,297,174,266);
line(194,297,194,370);
line(194,297,174,266);
line(40,224,80,220);
line(80,220,156,220);
line(156,220,199,224);
line(40,228,80,224);
line(80,224,156,224);
line(156,224,199,228);
ellipse(60,218,10,170,9,20);
ellipse(100,218,10,170,9,20);
ellipse(140,218,10,170,9,20);
ellipse(178,218,10,170,9,20);
line(40,195,40,220);
line(80,195,80,215);
line(120,195,120,215);
line(160,195,160,215);
line(200,195,200,215);
line(40,195,59,170);
line(80,195,59,170);
line(80,195,97,170);
line(120,195,97,170);
line(120,195,137,170);
line(160,195,137,170);
line(160,195,177,170);
line(200,195,177,170);
rectangle(90,137,166,168);
line(90,168,90,180);
line(166,168,166,186);
ellipse(106,173,20,143,20,32);
ellipse(106,173,10,170,14,29);
ellipse(146,173,10,160,20,32);
ellipse(146,173,10,170,12,29);
line(90,137,80,133);
line(80,133,90,127);
line(166,137,177,133);
line(177,133,166,127);
line(90,127,166,127);
ellipse(128,126,0,180,33,33);
setcolor(15);
ellipse(128,90,0,360,7,3);
line(128,80,128,87);
setcolor(12);
line(410,260,590,260);
line(410,265,590,265);
line(465,265,465,370);
line(528,265,528,370);
line(415,297,415,370);
line(415,297,433,266);
line(459,297,459,370);
line(459,297,436,266);
line(470,297,470,370);
line(470,297,494,266);
line(523,297,523,370);
line(523,297,494,266);
line(533,297,533,370);
line(533,297,556,266);
line(585,297,585,370);
line(585,297,556,266);
line(410,224,460,220);
line(460,220,530,220);
line(530,220,590,224);
line(410,228,460,224);
line(460,224,530,224);
line(530,224,590,228);
ellipse(430,218,10,170,9,20);
ellipse(476,218,10,170,9,20);
ellipse(519,218,10,170,9,20);
ellipse(565,218,10,170,9,20);
line(410,195,410,220);
line(454,195,454,215);
line(498,195,498,215);
line(540,195,540,215);
line(590,195,590,215);
line(410,195,429,170);
line(454,195,429,170);
line(454,195,476,170);
line(498,195,476,170);
line(498,195,520,170);
line(540,195,520,170);
line(540,195,565,170);
line(590,195,565,170);
rectangle(465,137,545,168);
line(545,168,545,189);
line(465,168,465,182);
ellipse(481,173,20,143,20,32);
ellipse(481,173,10,170,14,29);
ellipse(521,173,10,160,22,32);
ellipse(520,173,10,170,14,29);
line(464,137,456,133);
line(456,133,464,127);
line(544,137,554,133);
line(554,133,544,127);
line(465,127,544,127);
ellipse(504,126,0,180,33,33);
setcolor(15);
ellipse(504,90,0,360,7,3);
line(504,80,504,87);
//________center-upper__________
setcolor(12);
line(205,110,205,214);
line(215,110,215,214);
line(205,110,215,110);
line(205,120,215,120);
line(205,122,215,122);
line(205,124,215,124);
line(205,199,215,199);
ellipse(210,99,180,360,15,12);
line(196,99,203,99);
line(224,99,216,99);
ellipse(210,99,0,180,6,8);
line(200,80,200,99);
line(206,80,206,92);
line(212,80,212,92);
line(219,80,219,99);
line(199,80,220,80);
setcolor(15);
line(199,64,199,79);
line(220,64,220,79);
ellipse(210,64,0,180,10,8);
line(210,48,210,57);
setcolor(12);
line(405,110,405,214);
line(396,110,396,214);
line(405,110,396,110);
line(396,120,405,120);
line(396,122,405,122);
line(396,124,405,124);
line(396,199,405,199);
ellipse(400,99,180,360,15,12);
line(385,99,395,99);
line(406,99,416,99);
ellipse(400,99,0,180,6,8);
line(390,80,390,99);
line(396,80,396,92);
line(402,80,402,92);
line(409,80,409,99);
line(389,80,410,80);
setcolor(15);
line(389,64,389,79);
line(410,64,410,79);
ellipse(399,64,0,180,10,8);
line(400,48,400,57); ////
setcolor(12);
ellipse(230,218,10,170,9,20);
ellipse(266,218,10,170,9,20);
ellipse(303,218,10,170,9,20);
ellipse(343,218,10,170,9,20);
ellipse(380,218,10,170,9,20);
line(247,195,247,215);
line(285,195,285,215);
line(323,195,323,215);
line(360,195,360,215);
line(217,195,227,170);
line(247,195,227,170);
line(247,195,266,170);
line(285,195,266,170);
line(285,195,305,170);
line(323,195,305,170);
line(323,195,340,170);
line(360,195,340,170);
line(360,195,376,170);
line(395,195,376,170);
line(216,170,396,170);
setcolor(12);
ellipse(224,173,10,150,10,18);
ellipse(244,173,10,170,10,18);
ellipse(264,173,10,170,10,18);
ellipse(284,173,10,150,10,18);
ellipse(324,173,10,170,10,18);
ellipse(364,173,10,170,10,18);
ellipse(304,173,10,170,10,18);
ellipse(343,173,10,170,10,18);
ellipse(384,173,10,170,10,18);
line(216,150,396,150);
//_________ON TOP________
setcolor(15);
ellipse(240,142,10,170,7,11);
line(234,142,238,149);
line(246,140,242,149);
line(240,127,240,131);
ellipse(260,142,10,170,7,11);
line(267,140,260,150);
line(252,140,258,150);
line(260,127,260,131);
ellipse(280,142,10,170,7,11);
line(287,140,280,150);
line(272,140,278,150);
line(280,127,280,131);
ellipse(300,142,10,170,7,11);
line(307,140,300,150);
line(292,140,298,150);
line(300,127,300,131);
ellipse(320,142,10,170,7,11);
line(327,140,320,150);
line(312,140,318,150);
line(320,127,320,131);
ellipse(340,142,10,170,7,11);
line(347,140,340,150);
line(332,140,338,150);
line(340,127,340,131);
ellipse(360,142,10,170,7,11);
line(367,140,360,150);
line(352,140,358,150);
line(360,127,360,131);
//------ FLAG
setcolor(15);
rectangle(289,30,294,150);
setcolor(12);
rectangle(294,35,340,45);
setcolor(15);
rectangle(294,45,340,55);
setcolor(10);
rectangle(294,55,340,65);
setcolor(9);
circle(316,50,5);
line(312,46,316,50);
line(316,46,316,50);
line(319,46,316,50);
line(319,46,316,55);
line(312,46,316,54);
//_____TEXT
setcolor(4);
settextstyle(7,HORIZ_DIR,2);
outtextxy(240,406,"THE RED FORT");
setcolor(15);
settextstyle(3,HORIZ_DIR,2);
outtextxy(210,428,"PROUD TO BE AN INDIAN !");
setcolor(2);
outtextxy(165,450,"-MODIFIED BY ROHIT TECH STUDY");
getch();
closegraph();
}
Thursday, September 30, 2021
how to insert image in c program | insert image in c
//_________WELCOME ALL OF YOU ON ROHIT TECH STUDY CHANNEL_______________//
//__________ HOW TO INSERT IMAGE IN C GRAPHICS PROGRAM __________________//
#include <alloc.h>
#include <conio.h>
#include <graphics.h>
#include <stdio.h>
#include <stdlib.h>
struct BMP
{
char Type[2]; //File type. Set to "BM".
unsigned long Size; //Size in BYTES of the file.
unsigned long Reserved; //Reserved. Set to zero.
unsigned long OffSet; //Offset to the data.
unsigned long headsize; //Size of rest of header. Set to 40.
unsigned long Width; //Width of bitmap in pixels.
unsigned long Height; // Height of bitmap in pixels.
unsigned int Planes; //Number of Planes. Set to 1.
unsigned int BitsPerPixel; //Number of Bits per pixels.
unsigned long Compression; //Compression. Usually set to 0.
unsigned long SizeImage; //Size in bytes of the bitmap.
unsigned long XPixelsPreMeter; //Horizontal pixels per meter.
unsigned long YPixelsPreMeter; //Vertical pixels per meter.
unsigned long ColorsUsed; //Number of colors used.
unsigned long ColorsImportant; //Number of "important" colors.
};
int ShowBMP(int x, int y, char* FileName)
{
int b,a;
struct BMP Obj;
unsigned char* Datas;
int in=0;
unsigned char c=0;
FILE * fp;
fp = fopen(FileName,"rb");
if(!fp){
printf("Error : Unable to open file ..");
exit(0);
}
fread(&Obj, sizeof(Obj), 1, fp);
if(Obj.BitsPerPixel!=4) // This isn't a 16 color bmp we can read;
{
fclose(fp);
printf("Error : File format not supported ..");
exit(0);
};
fseek(fp,Obj.OffSet,SEEK_SET);
Datas=(unsigned char*) calloc(Obj.Width/2+1, sizeof(unsigned char));
for(b=Obj.Height;b>=0;b--)
{
fread(Datas, sizeof(unsigned char), Obj.Width/2, fp);
c=0;
in=0;
for(a=0;a<=Obj.Width;a+=2)
{
c = (Datas[in] | 0x00) >>4;
putpixel(a+x,b+y,c);
c = (Datas[in] | 0xF0) & 0x0F;
putpixel(a+1+x,b+y,c);
in++;
}
}
free (Datas);
fclose(fp);
return 1;
}
void main()
{
int color;
int gd , gm ;
gd = VGA ; gm = VGAHI;
initgraph(&gd,&gm,"c:\\tc\\bgi");
ShowBMP(0,0,"PUBG.BMP"); /* Enter File Name Here */
getch();
closegraph();
}
Wednesday, September 29, 2021
iron man in c++ programming
//____________WELCOME ALL OF YOU ON ROHIT TECH STUDY CHANNEL_______________//
/******************* C++ PROGRAM TO DRAW IRON MAN *************************/
#include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
#include<math.h>
bondaryFill(int p,int q,int r,int s)
{
int t;
t=getpixel(p,q);
if(t!=s && t!=r)
{
putpixel(p,q,r);
delay(1);
bondaryFill(p+1,q,r,s);
bondaryFill(p-1,q,r,s);
bondaryFill(p,q+1,r,s);
bondaryFill(p,q-1,r,s);
}
}
void main()
{
int maxx,maxy;
int gd=DETECT,gm;
initgraph(&gd, &gm,"C:\\TC\\BGI");
setcolor(0);
for(int i=0;i<639;i++)
{
line(0+i,0,0+i,479);
}
setcolor(12);
settextstyle(BOLD_FONT,HORIZ_DIR,1);
outtextxy(440,170,"IRON MAN");
setcolor(10);
settextstyle(BOLD_FONT,HORIZ_DIR,4);
outtextxy(480,200,"IS");
setcolor(14);
settextstyle(BOLD_FONT,HORIZ_DIR,5);
outtextxy(425,250,"BACK");
setcolor(14);
//-------------inner structure------------------//
line(273,68,285,65);delay(35);
line(285,65,298,63);delay(35);
line(298,63,306,63);delay(35);
line(306,63,314,65);delay(35);
line(314,65,327,66);delay(35);
line(327,66,334,68);delay(35);
line(334,68,328,117);delay(35);
line(328,117,279,117);delay(35);
line(279,117,273,68);delay(35);
bondaryFill(306,92,4,14);
line(283,124,324,124);delay(35);
line(324,124,324,178);delay(35);
line(324,178,314,180);delay(35);
line(314,180,304,182);delay(35);
line(304,182,294,180);delay(35);
line(294,180,283,178);delay(35);
line(283,178,283,124);delay(35);
bondaryFill(305,155,4,14);
//_____________outer structure_____________//
line(335,100,339,68);delay(30);
line(339,68,347,71);delay(30);
line(347,71,352,73);delay(30);
line(352,73,357,75);delay(30);
line(357,75,360,77);delay(30);
line(360,77,363,79);delay(30);
line(363,79,368,82);delay(30);
line(368,82,371,85);delay(30);
line(371,85,375,89);delay(30);
line(375,89,378,93);delay(30);
line(378,93,382,97);delay(30);
line(382,97,385,100);delay(30);
line(385,100,386,112);delay(30);
line(386,112,388,122);delay(30);
line(388,122,389,135);delay(30);
line(389,135,389,146);delay(30);
line(389,146,389,159);delay(30);
line(389,159,392,162);delay(30);
line(392,162,395,165);delay(30);
line(395,165,397,170);delay(30);
line(397,170,398,173);delay(30);
line(398,173,399,182);delay(30);
line(399,182,399,191);delay(30);
line(399,191,400,197);delay(30);
line(400,197,398,207);delay(30);
line(398,207,396,215);delay(30);
line(396,215,393,222);delay(30);
line(393,222,391,229);delay(30);
line(391,229,390,231);delay(30);
line(390,231,388,240);delay(30);
line(388,240,385,251);delay(30);
line(385,251,383,260);delay(30);
line(383,260,381,267);delay(30);
line(381,267,379,274);delay(30);
line(379,274,378,287);delay(30);
line(378,287,378,301);delay(30);
line(378,301,377,306);delay(30);
line(377,306,376,311);delay(30);
line(376,311,374,318);delay(30);
line(374,318,371,325);delay(30);
line(371,325,367,332);delay(30);
line(367,332,363,336);delay(30);
line(363,336,360,341);delay(30);
line(360,341,346,363);delay(30);
line(346,363,339,370);delay(30);
line(339,370,321,359);delay(30);
line(321,359,284,359);delay(30);
line(284,359,263,370);delay(30);
line(263,370,258,363);delay(30);
line(258,363,247,347);delay(30);
line(247,347,240,336);delay(30);
line(240,336,232,324);delay(30);
line(232,324,227,311);delay(30);
line(227,311,226,292);delay(30);
line(226,292,223,255);delay(30);
line(223,255,218,245);delay(30);
line(218,245,217,231);delay(30);
line(217,231,211,217);delay(30);
line(211,217,208,204);delay(30);
line(208,204,207,184);delay(30);
line(207,184,208,174);delay(30);
line(208,174,211,165);delay(30);
line(211,165,217,157);delay(30);
line(217,157,220,100);delay(30);
line(220,100,228,92);delay(30);
line(228,92,233,86);delay(30);
line(233,86,239,81);delay(30);
line(239,81,245,77);delay(30);
line(245,77,254,73);delay(30);
line(254,73,267,67);delay(30);
line(267,67,271,100);delay(30);
line(271,100,250,105);delay(30);
line(250,105,246,90);delay(30);
line(246,90,246,106);delay(30);
line(246,106,237,111);delay(30);
line(237,111,231,114);delay(30);
line(231,114,225,120);delay(30);
line(225,120,226,136);delay(30);
line(226,136,227,148);delay(30);
line(227,148,227,164);delay(30);
line(227,164,227,206);delay(30);
line(227,206,225,215);delay(30);
line(225,215,221,231);delay(30);
line(221,231,222,244);delay(30);
line(222,244,223,249);delay(30);
line(223,249,254,310);delay(30);
line(254,310,253,318);delay(30);
line(253,318,252,325);delay(30);
line(252,325,251,331);delay(30);
line(251,331,263,355);delay(30);
line(263,355,272,354);delay(30);
line(272,354,280,351);delay(30);
line(280,351,294,352);delay(30);
line(294,352,296,351);delay(30);
line(296,351,298,350);delay(30);
line(298,350,299,349);delay(30);
line(299,349,307,349);delay(30);
line(307,349,312,352);delay(30);
line(312,352,327,352);delay(30);
line(327,352,334,355);delay(30);
line(334,355,341,355);delay(30);
line(341,355,355,329);delay(30);
line(355,329,353,321);delay(30);
line(353,321,353,316);delay(30);
line(353,316,357,306);delay(30);
line(357,306,365,291);delay(30);
line(365,291,371,281);delay(30);
line(371,281,375,275);delay(30);
line(375,275,378,266);delay(30);
line(378,266,382,254);delay(30);
line(382,254,384,242);delay(30);
line(384,242,386,233);delay(30);
line(386,233,385,227);delay(30);
line(385,227,383,218);delay(30);
line(383,218,381,212);delay(30);
line(381,212,380,209);delay(30);
line(380,209,381,120);delay(30);
line(381,120,376,116);delay(30);
line(376,116,373,114);delay(30);
line(373,114,367,111);delay(30);
line(367,111,359,108);delay(30);
line(359,108,358,92);delay(30);
line(358,92,353,104);delay(30);
line(353,104,335,100);delay(30);
line(375,89,367,111);delay(30);
line(396,215,381,212);delay(30);
line(367,332,355,329);delay(30);
line(228,92,231,114);delay(30);
line(211,217,227,206);delay(30);
bondaryFill(349,88,4,14);
bondaryFill(255,86,4,14);
bondaryFill(384,138,4,14);
bondaryFill(368,300,4,14);
bondaryFill(302,355,4,14);
bondaryFill(216,185,4,14);
/*.....right..........*/
line(267,371,283,363);delay(30);
line(283,363,320,363);delay(30);
line(320,363,334,371);delay(30);
line(334,371,327,372);delay(30);
line(327,372,315,373);delay(30);
line(315,373,291,373);delay(30);
line(291,373,280,372);delay(30);
line(280,372,267,371);delay(30);
bondaryFill(299,368,4,14);
//...........................//
line(257,321,268,339);delay(30);
line(268,339,276,329);delay(30);
line(276,329,330,329);delay(30);
line(330,329,338,339);delay(30);
line(338,339,348,321);delay(30);
line(348,321,349,330);delay(30);
line(349,330,340,349);delay(30);
line(340,349,338,351);delay(30);
line(338,351,334,349);delay(30);
line(334,349,328,346);delay(30);
line(328,346,312,346);delay(30);
line(312,346,311,345);delay(30);
line(311,345,297,345);delay(30);
line(297,345,296,347);delay(30);
line(296,347,280,346);delay(30);
line(280,346,269,350);delay(30);
line(269,350,267,351);delay(30);
line(267,351,256,332);delay(30);
line(256,332,257,321);delay(30);
bondaryFill(301,337,14,14);
//_____________head_________________//
line(229,123,237,117);delay(30);
line(237,117,242,115);delay(30);
line(242,115,245,114);delay(30);
line(245,114,251,112);delay(30);
line(251,112,260,110);delay(30);
line(260,110,266,107);delay(30);
line(266,107,272,106);delay(30);
line(272,106,279,182);delay(30);
line(279,182,303,189);delay(30);
line(303,189,326,182);delay(30);
line(326,182,334,104);delay(30);
line(334,104,346,109);delay(30);
line(346,109,355,112);delay(30);
line(355,112,361,115);delay(30);
line(361,115,367,118);delay(30);
line(367,118,373,121);delay(30);
line(373,121,377,124);delay(30);
line(377,124,375,133);delay(30);
line(375,133,374,139);delay(30);
line(374,139,373,145);delay(30);
line(373,145,372,151);delay(30);
/*______________________________*/
line(372,151,371,159);delay(30);
line(371,159,370,167);delay(30);
line(370,167,369,185);delay(30);
line(369,185,369,186);delay(30);
line(369,186,368,207);delay(30);
line(368,207,369,214);delay(30);
line(369,214,370,220);delay(30);
line(370,220,329,236);delay(30);
line(329,236,323,238);delay(30);
line(323,238,319,241);delay(30);
line(319,241,313,242);delay(30);
line(313,242,306,243);delay(30);
line(306,243,295,243);delay(30);
line(295,243,284,243);delay(30);
line(284,243,277,236);delay(30);
line(277,236,272,235);delay(30);
line(272,235,236,221);delay(30);
line(236,221,237,212);delay(30);
line(237,212,238,204);delay(30);
line(238,204,239,205);delay(30);
/* ............................ */
line(239,205,240,196);delay(30);
line(240,196,239,183);delay(30);
line(239,183,238,174);delay(30);
line(238,174,237,165);delay(30);
line(237,165,236,161);delay(30);
line(236,161,235,153);delay(30);
line(235,153,233,146);delay(30);
line(233,146,232,136);delay(30);
line(232,136,230,128);delay(30);
line(230,128,229,123);delay(30);
line(279,182,236,221);delay(30);
line(326,182,370,220);delay(30);
bondaryFill(257,167,14,14);
bondaryFill(300,217,14,14);
bondaryFill(352,142,14,14);
/************ Mouth **************/
line(234,232,244,247);delay(40);
line(244,247,279,255);delay(40);
line(279,255,283,249);delay(40);
line(283,249,301,250);delay(40);
line(301,250,318,249);delay(40);
line(318,249,324,256);delay(40);
line(324,256,361,249);delay(40);
line(361,249,370,239);delay(40);
line(370,239,370,251);delay(40);
line(370,251,362,280);delay(40);
line(362,280,331,324);delay(40);
line(331,324,276,325);delay(40);
line(276,325,245,281);delay(40);
line(245,281,234,248);delay(40);
line(234,248,234,232);delay(40);
line(279,255,276,325);delay(40);
line(324,256,331,324);delay(40);
bondaryFill(299,290,14,14);
bondaryFill(261,276,14,14);
bondaryFill(344,276,14,14);
//_____________eye 1th_______________//
for(int v=0; v<13; v++)
{
line(235,225,277,242);delay(20);
line(277,242,280,244);delay(20);
line(280,244,278,248);delay(20);
line(278,248,264,248);delay(20);
line(264,248,248,242);delay(20);
line(248,242,235,225);delay(20);
//___________eye 2nd______________//
line(370,223,324,245);delay(20);
line(324,245,326,248);delay(20);
line(326,248,337,247);delay(20);
line(337,247,349,245);delay(20);
line(349,245,355,243);delay(20);
line(355,243,370,231);delay(20);
line(370,231,370,223);delay(20);
bondaryFill(254,238,v,14);
bondaryFill(348,240,v,14);
}
bondaryFill(254,238,WHITE,14);
bondaryFill(348,240,WHITE,14);
getch();
}
captain america shield c programming
captain america shield c++ video
//____________ WELCOME ALL OF YOU ON ROHIT TECH STUDY CHANNEL _____________//
//______________C++ PROGRAM TO DRAW CAPTAIN AMERICA SHIELD_________________//
#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<graphics.h>
#include<stdlib.h>
void star()
{
int pantagon_point[]={300,210, 350,210, 365,265, 325,295, 275,260, 300,210};
int triangle1_point[]={325,135, 350,210, 300,210, 325,135};
int triangle2_point[]={435,210, 365,265, 350,210, 435,210};
int triangle3_point[]={400,340, 365,265, 325,295, 400,340};
int triangle4_point[]={250,340, 325,295, 275,260, 250,340};
int triangle5_point[]={220,210, 275,260, 300,210, 320,210};
setcolor(11);
setfillstyle(1,15);
fillpoly(6,pantagon_point);delay(500);
fillpoly(4,triangle1_point);delay(500);
fillpoly(4,triangle2_point);delay(500);
fillpoly(4,triangle3_point);delay(500);
fillpoly(4,triangle4_point);delay(500);
fillpoly(4,triangle5_point);delay(500);
}
void circle(int r,int c)
{
setcolor(c);
circle(328.5 ,250.5,r);
setfillstyle(9,c);
floodfill(327,250,c);
delay(500);
}
void shield()
{
circle(227,4);
circle(190,15);
circle(150,4);
circle(120,1);
star();
delay(500);
}
int main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"c://tc//bgi");
shield();
getch();
closegraph();
return 0;
}
kon banega crorpati in c++ programming
//___________WELCOME ALL OF YOU ON ROHIT TECH STUDY CHANNEL_______________//
//_____________________ C++ PROGRAM TO MAKE KBC GAME ______________________//
//>>>>>>>>>>>>>>>......___ KAUN BANEGA CROREPATI ____.....<<<<<<<<<<<<<<<<<//
#include<graphics.h>
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<math.h>
#include<fstream.h>
#include<string.h>
union REGS i,o;
int flag;
int ansbox1=0,ansbox2=0;
int life1=0,life2=0,life3=0,f3=0;
int button, x1,y1;
long double size;
char str[8]={'0'};
char total[10]={'0'};
long double p=500;
ifstream fin;
char correctans[2];
void page2();
void page3();
void line();
void questions();
void incorrect1();
void incorrect2();
void incorrect3();
void incorrect4();
void phonefriend();
void fiftyfifty();
void audiencepoll();
void sorry();
void select();
void correct();
void startscreen();
void totalprizemoney();
void music();
void askname();
int offset=0,num;
int prev[15],count=0;
initmouse()
{
i.x.ax=0;
int86(0x33,&i,&o);
return(o.x.ax);
}
void showmouseptr()
{
i.x.ax=1;
int86(0x33,&i,&o);
}
void hidemouseptr()
{
i.x.ax=2;
int86(0x33,&i,&o);
}
void getmousepos(int *button,int *x,int *y)
{
i.x.ax=3;
int86(0x33,&i,&o);
*button=o.x.bx;
*x=o.x.cx;
*y=o.x.dx;
}
void main()
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "c:\\tC\\bgi");
/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n",grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error code */
}
if(initmouse()==0)
{
closegraph();
restorecrtmode();
//to go back to normal graphics mode or deleting viewport.
printf(" mouse driver not loaded");
exit(1);
}
startscreen();
p=500;
ansbox1=0,ansbox2=0;
count=0;
life1=0,life2=0,life3=0;
page2();
hidemouseptr();
page3();
closegraph();
restorecrtmode();
}
void page2()
{
cleardevice();
settextstyle(12,0,5);
setcolor(10);
outtextxy(20,10,"ROHIT TECH STUDY");
setlinestyle(1,0,1);
setcolor(BLUE);
setlinestyle(0,0,3);
rectangle(500,5,625,350);
line(0,350,625,350);
setcolor(LIGHTBLUE);
int poly[]={40,390,60,365,560,365,580,390,560,415,60,415,40,390};
drawpoly(7,poly);
line(0,390,40,390);line(580,390,620,390);
int poly1[]={40,430,50,420,290,420,300,430,290,445,50,445,40,430};
drawpoly(7,poly1);
int poly2[]={300,430,310,420,575,420,585,430,575,445,310,445,300,430};
drawpoly(7,poly2);
int poly3[]={40,465,50,450,290,450,300,465,290,475,50,475,40,465};
drawpoly(7,poly3);
int poly4[]={300,465,310,450,575,450,585,465,575,475,310,475,300,465};
line(0, 430,40,430);line(0,465,40,465);
line(585,430,620,430);line(585,465,620,465);
drawpoly(7,poly4);
setfillstyle(1,RED);
settextstyle(2,0,0);
fillellipse(525,20,20,10);
fillellipse(565,20,20,10);
fillellipse(605,20,20,10);
setcolor(YELLOW);
outtextxy(510,15,"50:50");
outtextxy(550,15,"PHONE");
outtextxy(589,13,"PUBLIC");
outtextxy(593,18,"vote");
settextstyle(12,0,2);
setcolor(YELLOW);
outtextxy(520,50," 10000000");
setcolor(LIGHTBLUE);
outtextxy(520,70," 5000000");
outtextxy(520,90," 2500000");
outtextxy(520,110," 1250000");
outtextxy(520,130," 640000");
setcolor(YELLOW);
outtextxy(520,150," 320000");
setcolor(LIGHTBLUE);
outtextxy(520,170," 160000");
outtextxy(520,190," 80000");
outtextxy(520,210," 40000");
outtextxy(520,230," 20000");
setcolor(YELLOW);
outtextxy(520,250," 10000");
setcolor(LIGHTBLUE);
outtextxy(520,270," 5000");
outtextxy(520,290," 3000");
outtextxy(520,310," 2000");
outtextxy(520,330," 1000");
count=0;
askname();
questions();
getch();
}
void page3()
{
cleardevice();
settextstyle(12,0,1);
for(int i=490;i>=200;i--)
{
setcolor(10);
}
setcolor(10);
setcolor(WHITE);
outtextxy(10,460,"PRESS ANY KEY TO CONTINUE ");
getch();
exit(0);
}
char proc[]={"PROCESSING........"};
void line()
{
setlinestyle(0,0,1);
for(int x=0;x<=485;x++)
{ setcolor(LIGHTGRAY);
line(x+10,20,x+10,340);
setcolor(0);
rectangle(0,20,x,340);
line(x+10,20,x+10,340);
}
setlinestyle(0,0,3);
sleep(1);
}
void questions()
{
char question[200];
char ans1[150];
char ans2[150];
char ans3[150];
char ans4[150];
int temp=0;
char ch,ch1;
int num=0,ct=0,i=0,t=0;
int randnum[15];
char str[4],co[4],numc[2];
randomize();
fin.open("KBC.txt",ios::binary);
while(!fin.eof())
{
fin.get(ch);
if(ch=='\n')
t++;
}
fin.close();
t=t/6;
fin.open("KBC.txt",ios::binary);
settextstyle(COMPLEX_FONT,0,3);
setcolor(RED);
outtextxy(150,310,"LET's PLAY !!!");
sleep(3);
setcolor(BLACK);
outtextxy(150,310,"LET's PLAY !!!");
while(ct<15)
{
count=0;
num=random(t);
for(i=0;i<temp;i++)
{
if(randnum[i]==num)
{
num=random(t);
i=0;
}
}
randnum[temp]=num;
temp++;
fin.seekg(0,ios::beg);
while(!fin.eof())
{
fin.get(ch);
if(ch=='\n')
count++;
if(count==(6*num))
{
break;
}
} if(ct>0)
{
setcolor(RED);
outtextxy(150,310,"NEXT question !!!");
sleep(3);
setcolor(BLACK);
outtextxy(150,310,"NEXT question !!!");
}
fin.getline(question,200,'\n');
fin.getline(ans1,150,'\n');
fin.getline(ans2,150,'\n');
fin.getline(ans3,150,'\n');
fin.getline(ans4,150,'\n');
fin.getline(correctans,2,'\n');
if(strlen(question)>=40||strlen(ans1)>=25||strlen(ans2)>=25||strlen(ans3)>=25||strlen(ans4)>=25)
settextstyle(COMPLEX_FONT,0,1);
else
settextstyle(COMPLEX_FONT,0,2);
setcolor(RED);
setcolor(15);
outtextxy(60,375,question);
outtextxy(60,415,ans1);
outtextxy(320,415,ans2);
outtextxy(60,445,ans3);
outtextxy(320,445,ans4);
showmouseptr();
if(correctans[0]=='a')
{
incorrect1();
}
else if(correctans[0]=='b')
{
incorrect2();
}
else if(correctans[0]=='c')
{
incorrect3();
}
else if(correctans[0]=='d')
{
incorrect4();
}
ct++;
}
if(ct==15)
totalprizemoney();
fin.close();
}
void incorrect1()
{
count++;
showmouseptr();
flag=0;
select();
while(flag==0)
{
getmousepos(&button,&x1,&y1);
if((button & 1)==1)
{
if((x1>=0&&x1<=300)&&(y1>=420&&y1<=445))
correct();
else if((x1>=300&&x1<=585&&y1>=420&&y1<=445)||(x1>=0&&x1<=300&&y1>=450&&y1<=475)||(x1>=300&&x1<=585&&y1>=450&&y1<=475))
sorry();
}
}
}
void incorrect2()
{ count++;
showmouseptr();
flag=0;
select();
while(flag==0)
{
getmousepos(&button,&x1,&y1);
if((button & 1)==1)
{
if((x1>=300&&x1<=585)&&(y1>=420&&y1<=445))
correct();
else if ((x1>=0&&x1<=300&&y1>=420&&y1<=445)||(x1>=0&&x1<=300&&y1>=450&&y1<=475)||(x1>=300&&x1<=585&&y1>=450&&y1<=475))
sorry();
}
}
}
void incorrect3()
{ count++;
showmouseptr();
flag=0;
select();
while(flag==0)
{
getmousepos(&button,&x1,&y1);
if((button & 1)==1)
{
if((x1>=0&&x1<=300)&&(y1>=450&&y1<=475))
correct();
else if((x1>=0&&x1<=300&&y1>=420&&y1<=445)||(x1>=300&&x1<=585&&y1>=420&&y1<=445)||(x1>=300&&x1<=585&&y1>=450&&y1<=475))
sorry();
}
}
}
void incorrect4()
{ count++;
showmouseptr();
flag=0;
select();
while(flag==0)
{
getmousepos(&button,&x1,&y1);
if((button & 1)==1)
{
if((x1>=300&&x1<=585)&&(y1>=450&&y1<=475))
correct();
else if((x1>=0&&x1<=300)&&(y1>=420&&y1<=445)||(x1>=300&&x1<=585&&y1>=420&&y1<=445)||(x1>=0&&x1<=300&&y1>=450&&y1<=475))
sorry();
}
}
}
char prevstr[10]={"1000"};
void correct()
{
hidemouseptr();
flag=1;
p=p*2;
if(p==4000)
p=3000;
if(p==6000)
p=5000;
if(p==1280000)
p=1250000;
ltoa(p,str,10);
sleep(2);
setcolor(BLUE);
setfillstyle(1,YELLOW);
line(0,250,40,250);line(460,250,500,250);
int pol[]={40,250,60,235,460,235,480,250,460,265,60,265,40,250};
fillpoly(7,pol);
setcolor(BLUE);
settextstyle(0,0,3);
outtextxy(200,240,str);
settextstyle(0,0,1);
setcolor(WHITE);
setcolor(BLACK);
setfillstyle(1,BLACK);
settextstyle(0,0,1);
if(ansbox2==1)
{
bar(503,345+ansbox1,622,360+ansbox1);
setcolor(WHITE);
outtextxy(520,350+ansbox1,"");
outtextxy(540,350+ansbox1,prevstr);
}
setcolor(RED);
ansbox2=1;
setfillstyle(1,RED);
setcolor(WHITE);
settextstyle(0,0,1);
ansbox1=ansbox1-20;
bar(503,345+ansbox1,622,360+ansbox1);
outtextxy(520,350+ansbox1,"");
outtextxy(540,350+ansbox1,str);
ltoa(p,prevstr,10);
if(p==10000||p==320000||p==10000000)
music();
sleep(1);
setcolor(BLACK);
setfillstyle(1,BLACK);
bar3d(0,230,495,270,0,1);
settextstyle(COMPLEX_FONT,0,2);
setcolor(RED);
sleep(1);
setcolor(LIGHTBLUE);
setfillstyle(1,BLACK);
int poly[]={40,390,60,365,560,365,580,390,560,415,60,415,40,390};
fillpoly(7,poly);
line(0,390,40,390);line(580,390,620,390);
int poly1[]={40,430,50,420,290,420,300,430,290,445,50,445,40,430};
fillpoly(7,poly1);
int poly2[]={300,430,310,420,575,420,585,430,575,445,310,445,300,430};
fillpoly(7,poly2);
int poly3[]={40,465,50,450,290,450,300,465,290,475,50,475,40,465};
fillpoly(7,poly3);
int poly4[]={300,465,310,450,575,450,585,465,575,475,310,475,300,465};
line(0, 430,40,430);line(0,465,40,465);
line(585,430,620,430);line(585,465,620,465);
fillpoly(7,poly4);
}
void sorry()
{
hidemouseptr();
sleep(1);
setcolor(BLUE);
settextstyle(0,0,3);
outtextxy(50,200,"SORRY ! INCORRECT");
sleep(2);
fin.close();
clearviewport();
setcolor(BLUE);
totalprizemoney();
}
void totalprizemoney()
{
hidemouseptr();
clearviewport();
setcolor(BLUE);
setfillstyle(1,YELLOW);
line(0,390,40,390);line(580,390,620,390);
int pol[]={40,390,60,365,560,365,580,390,560,415,60,415,40,390};
fillpoly(7,pol);
setcolor(RED);
settextstyle(0,0,2);
outtextxy(70,380,"Total prize money:");
setcolor(BLUE);
outtextxy(360,380,str);
settextstyle(0,0,1);
setcolor(GREEN);
outtextxy(100,430,"USE THE KEYBOARD ARROW KEYS TO SELECT");
setfillstyle(1,YELLOW);
bar(80,445,150,460);
char a=0,x='E';int flg=0;
do
{
outtextxy(100,450,"REPLAY EXIT");
a=getch();
switch(a)
{
case 13 :
if((flg%2)==0)
x='R';
else
x='E';
break;
case 77:
case 75:
if((flg%2)==0)
{
setfillstyle(1,0);
bar(80,445,150,460);
setfillstyle(1,YELLOW);
bar(200,445,270,460);
}
else
{
setfillstyle(1,0);
bar(200,445,270,460);
setfillstyle(1,YELLOW);
bar(80,445,150,460);
}
break;
}
if(a==75||a==77)
flg++;
}while(a!=13);
if(x=='R')
{
clearviewport();
closegraph();
main();
}
else if(x=='E')
{
page3();
closegraph();
exit(0);
}
}
void pass(int poly[14])
{
setfillstyle(1,LIGHTBLUE);
setcolor(LIGHTBLUE);
drawpoly(7,poly);
ellipse(605,20,0,360,20,10);
ellipse(525,20,0,360,20,10);
ellipse(565,20,0,360,20,10);
setfillstyle(1,YELLOW);
setcolor(YELLOW);
}
void select()
{
int polygon1[]={40,430,50,420,290,420,300,430,290,445,50,445,40,430};
int polygon2[]={300,430,310,420,575,420,585,430,575,445,310,445,300,430};
int polygon3[]={40,465,50,450,290,450,300,465,290,475,50,475,40,465};
int polygon4[]={300,465,310,450,575,450,585,465,575,475,310,475,300,465};
setcolor(RED);
setfillstyle(1,RED);
setlinestyle(1,0,15);
do
{
settextstyle(3,0,2);
setcolor(BLACK);
outtextxy(30,270,"LIFELINE TAKEN ALREADY");
x:
getmousepos(&button,&x1,&y1);
if(x1>=0&&x1<=300&&y1>=420&&y1<=445)
{
pass(polygon2);
pass(polygon3);
pass(polygon4);
drawpoly(7,polygon1);
}
else if(x1>=300&&x1<=585&&y1>=420&&y1<=445)
{
pass(polygon1);
pass(polygon3);
pass(polygon4);
drawpoly(7,polygon2);
}
else if(x1>=0&&x1<=300&&y1>=450&&y1<=475)
{
pass(polygon1);
pass(polygon2);
pass(polygon4);
drawpoly(7,polygon3);
}
else if(x1>=300&&x1<=585&&y1>=450&&y1<=475)
{
pass(polygon1);
pass(polygon3);
pass(polygon2);
drawpoly(7,polygon4);
}
//...............select lifeline............//
//50:50
else if(x1>=505&&x1<=545&&y1>=10&&y1<=30)
{
if(life1==1&&(button &1)==1)
{
settextstyle(3,0,2);
setcolor(YELLOW);
outtextxy(30,270,"LIFELINE TAKEN ALREADY");
goto x;
}
setcolor(YELLOW);
ellipse(525,20,0,360,20,10);
setcolor(LIGHTBLUE);
ellipse(605,20,0,360,20,10);
ellipse(565,20,0,360,20,10);
fiftyfifty();
goto x;
}
//___________Phone a friend___________//
else if(x1>=545&&x1<=585&&y1>=10&&y1<=30)
{
if(life2==1&&(button &1)==1)
{
settextstyle(3,0,2);
setcolor(YELLOW);
outtextxy(30,270,"LIFELINE TAKEN ALREADY");
goto x;
}
setcolor(YELLOW);
ellipse(565,20,0,360,20,10);
setcolor(LIGHTBLUE);
ellipse(605,20,0,360,20,10);
ellipse(525,20,0,360,20,10);
phonefriend();
goto x;
}
//...........audience poll..............//
else if(x1>=585&&x1<=625&&y1>=10&&y1<=30)
{
if(life3==1&&(button &1)==1)
{
settextstyle(3,0,2);
setcolor(YELLOW);
outtextxy(30,270,"LIFELINE TAKEN ALREADY");
goto x;
}
setcolor(YELLOW);
ellipse(605,20,0,360,20,10);
setcolor(LIGHTBLUE);
ellipse(565,20,0,360,20,10);
ellipse(525,20,0,360,20,10);
audiencepoll();
goto x;
}
}
while((button & 1)!=1);
}
void startscreen()
{
setlinestyle(0,0,3);
setcolor(BLUE);
setfillstyle(1,BLUE);
circle(300,225,225);
floodfill(300,200,BLUE);
setcolor(LIGHTBLUE);
setfillstyle(1,LIGHTBLUE);
circle(300,225,185);
floodfill(300,200,LIGHTBLUE);
setcolor(0);
setfillstyle(SLASH_FILL,0);
setlinestyle(1,0,0);
for(int p=0;p<=185;p++)
{
circle(300,225,p);
delay(10);
}
setlinestyle(1,0,3);
setcolor(BLUE);
setfillstyle(7,BLUE);
fillellipse(300,225,30,185);
fillellipse(300,225,185,30);
setcolor(BLUE);
setcolor(15);
setfillstyle(1,15);
setcolor(15);
settextstyle(8,0,5);
settextstyle(0,0,3);
outtextxy(100,125,"K");
outtextxy(125,85,"A");
outtextxy(155,55,"U");
outtextxy(195,25,"N");
outtextxy(300,10,"B");
outtextxy(350,20,"A");
outtextxy(395,35,"N");
outtextxy(435,65,"E");
outtextxy(465,105,"G");
outtextxy(485,140,"A");
setcolor(YELLOW);
outtextxy(495,180,"");
outtextxy(85,180,"");
outtextxy(495,250,"");
outtextxy(85,250,"");
setcolor(15);
outtextxy(100,305,"K");
outtextxy(125,345,"A");
outtextxy(155,375,"U");
outtextxy(195,405,"N");
outtextxy(300,420,"B");
outtextxy(350,415,"A");
outtextxy(395,395,"N");
outtextxy(435,365,"E");
outtextxy(465,335,"G");
outtextxy(485,290,"A");
setlinestyle(1,0,3);
setcolor(5);
setfillstyle(0,5);
circle(300,225,185);
settextstyle(12,0,5);
setcolor(10);
outtextxy(510,470,"ROHIT PROGRAMMING");
setlinestyle(1,0,1);
setcolor(15);
settextstyle(8,0,5);
outtextxy(265,195," E ");
sound(1000);
delay(600);
outtextxy(215,195," R ");
outtextxy(315,195," P ");
sound(1100);
delay(600);
sound(1200);
delay(500);
outtextxy(170,195," O ");
outtextxy(365,195," A ");
sound(1000);
delay(500);
sound(1100);
delay(550);
outtextxy(115,195," R ");
outtextxy(400,195," T ");
sound(1200);
delay(450);
sound(1350);
delay(450);
outtextxy(85,195,"C ");
outtextxy(500,195,"I");
sound(1500);
delay(1000);
nosound();
settextstyle(0,0,1);
outtextxy(10,460,"PRESS ANY KEY TO CONTINUE ");
getch();
}
void music()
{
sound(1000);
delay(600);
sound(1100);
delay(600);
sound(1200);
delay(500);
sound(1000);
delay(500);
sound(1100);
delay(550);
sound(1200);
delay(450);
sound(1350);
delay(450);
sound(1500);
delay(1000);
nosound();
}
void askname()
{
settextstyle(0,0,1);
setcolor(7);
outtextxy(0,90,"WELCOME TO THE COMPUTER VERSION OF KAUN BANEGA CROREPATI");
outtextxy(0,115,"please enter your name : ");
char name[40];
gotoxy(30,8);
cin.getline(name,40);
outtextxy(0,150,"please enter your city : ");
char city[40];
gotoxy(30,10);
cin.getline(city,40);
sleep(1);
line();
sleep(1);
setcolor(7);
outtextxy(10,90,"LET'S WELCOME ");
outtextxy(270,110," FROM ");
setcolor(RED);
outtextxy(150,90,name);
outtextxy(320,110,city);
setcolor(LIGHTGREEN);
outtextxy(0,150,"IMPORTANT INSTRUCTIONS ");
sleep(2);
setcolor(LIGHTGRAY);
outtextxy(0,170,"USE THE MOUSE TO PLAY THE GAME. ");
sleep(2);
setcolor(LIGHTGREEN);
outtextxy(0,190,"PLEASE CLICK AND HOLD THE LEFT MOUSE BUTTON TO SELECT.");
sleep(2);
setcolor(LIGHTGRAY);
outtextxy(0,210,"YOU HAVE 3 LIFELINES (AS INDICATED ON THE UPPER RIGHT CORNER).");
outtextxy(0,230,"CLICK ON THE LIFELINES TO SELECT THEM.");
sleep(2);
outtextxy(0,250,"THE FILE KBC.TXT IS AN EVER EXPANDABLE QUESTION BANK..");
outtextxy(0,260,"PLEASE STICK ON TO THE FORMAT USED IN THE FILE WHILE.. ");
outtextxy(100,270,"EXPANDING THE QUESTION BANK" );
setcolor(WHITE);
sleep(2);
settextstyle(0,0,1);
outtextxy(0,320,"PRESS ANY KEY TO CONTINUE ");
getch();
line();
settextstyle(BOLD_FONT,0,1);
}
void phonefriend()
{
settextstyle(3,0,2);
setcolor(BLACK);
outtextxy(30,270,"LIFELINE TAKEN ALREADY");
if(((button &1)==1)&&life2==0)
{
hidemouseptr();
setcolor(LIGHTBLUE);
settextstyle(0,HORIZ_DIR,2);
outtextxy(30,250,"PHONE A FRIEND ....... ");
sleep(1);
outtextxy(30,270,"YOUR TIME STARTS.....NOW ");
sleep(1);
line();
setcolor(LIGHTGRAY);
setfillstyle(2,RED);
circle(300,200,100);
char arc[10];
settextstyle(0,HORIZ_DIR,5);
int x=0;
setfillstyle(1,DARKGRAY);
for(int i=0;i<=30;i++)
{
setcolor(BLACK);
pieslice(300,200,0,i*12,97);
itoa(i,arc,10);
setcolor(BLUE);
if(i>=10)
x=25;
outtextxy(280-x,180,arc);
sleep(1);
setcolor(BLACK);
outtextxy(280-x,180,arc);
}
life2=1;
setcolor(YELLOW);
settextstyle(3,HORIZ_DIR,3);
outtextxy(0,315,"YOUR TIME ENDS HERE. CLICK AN ANSWER");
sleep(3);
line();
showmouseptr();
}
}
void fiftyfifty()
{
settextstyle(3,0,2);
setcolor(BLACK);
outtextxy(30,270,"LIFELINE TAKEN ALREADY");
randomize();
int r1=0,r2=0;
if(((button &1)==1)&&life1==0)
{
setcolor(LIGHTBLUE);
settextstyle(0,HORIZ_DIR,2);
outtextxy(30,250,"50:50 LIFELINE ");
sleep(1);
outtextxy(0,270,"TWO WRONG CHOICES WILL");
outtextxy(280,290,"BE ELIMINATED");
sleep(1);
line();
if(correctans[0]=='a')
{
while(r1==0||r2==0||r1==r2)
{
r1=random(4);
r2=random(4);
}
}
if(correctans[0]=='b')
{
while(r1==1||r2==1||r1==r2)
{
r1=random(4);
r2=random(4);
}
}
if(correctans[0]=='c')
{
while(r1==2||r2==2||r1==r2)
{
r1=random(4);
r2=random(4);
}
}
if(correctans[0]=='d')
{
while(r1==3||r2==3||r1==r2)
{
r1=random(4);
r2=random(4);
}
}
setcolor(BLACK);
setfillstyle(1,BLACK);
int poly1[]={40,430,50,420,290,420,300,430,290,445,50,445,40,430};
int poly2[]={300,430,310,420,575,420,585,430,575,445,310,445,300,430};
int poly3[]={40,465,50,450,290,450,300,465,290,475,50,475,40,465};
int poly4[]={300,465,310,450,575,450,585,465,575,475,310,475,300,465};
if(r1==0)
fillpoly(7,poly1);
else if(r1==1)
fillpoly(7,poly2);
else if(r1==2)
fillpoly(7,poly3);
else if(r1==3)
fillpoly(7,poly4);
if(r2==0)
fillpoly(7,poly1);
else if(r2==1)
fillpoly(7,poly2);
else if(r2==2)
fillpoly(7,poly3);
else if(r2==3)
fillpoly(7,poly4);
life1=1;
}
}
void audiencepoll()
{
settextstyle(3,0,2);
setcolor(BLACK);
outtextxy(30,270,"LIFELINE TAKEN ALREADY");
randomize();
int r1=0,r2=0,r3=0,r4=0;
if(((button &1)==1)&&life3==0)
{
hidemouseptr();
setcolor(LIGHTBLUE);
settextstyle(0,HORIZ_DIR,2);
outtextxy(30,250,"AUDIENCE POLL ");
sleep(2);
line();
if(correctans[0]=='a')
{
while(r1<r2||r1<r3||r1<r4||r1+r2+r3+r4!=100)
{
r1=random(100);
r2=random(100);
r3=random(100);
r4=random(100);
}
}
else if(correctans[0]=='b')
{
while(r2<r1||r2<r3||r2<r4||r1+r2+r3+r4!=100)
{
r1=random(100);
r2=random(100);
r3=random(100);
r4=random(100);
}
}
else if(correctans[0]=='c')
{
while(r3<r1||r3<r2||r3<r4||r1+r2+r3+r4!=100)
{
r1=random(100);
r2=random(100);
r3=random(100);
r4=random(100);
}
}
else if(correctans[0]=='d')
{
while(r4<r1||r4<r2||r4<r3||r1+r2+r3+r4!=100)
{
r1=random(100);
r2=random(100);
r3=random(100);
r4=random(100);
}
}
char r11[20];
char r22[20];char r33[20];char r44[20];
itoa(r1,r11,10);
itoa(r2,r22,10);
itoa(r3,r33,10);
itoa(r4,r44,10);
setcolor(YELLOW);
bar(240,150-r1,260,150);
bar(265,150-r2,280,150);
bar(285,150-r3,300,150);
bar(305,150-r4,320,150);
settextstyle(0,0,1);
setcolor(GREEN);
outtextxy(240,152,"A B C D");
outtextxy(240,140-r1,r11);
outtextxy(265,140-r2,r22);
outtextxy(285,140-r3,r33);
outtextxy(305,140-r4,r44);
setcolor(RED);
rectangle(230,30,330,175);
life3=1;
f3=1;
setcolor(YELLOW);
settextstyle(1,0,2);
outtextxy(0,250,"Press any key on the keyboard to continue..");
showmouseptr();
getch();
line();
}
}
dino game in c language | chrome dinosaur game in c++
//...........WELCOME ALL OF YOU ON ROHIT TECH STUDY CHANNEL...............//
//______________ C++ PROGRAM TO DRAW DINOSAUR JUMP GAME __________________//
//<<<<<<<<<<<<<<<<<<<<<< CHROME DINOSAUR GAME >>>>>>>>>>>>>>>>>>>>>>>//
#include<stdio.h>
#include<dos.h>
#include<stdlib.h>
#include<conio.h>
void getup()
{
textcolor(4);
textbackground(3);
clrscr();
window(2,2,70,3);
cprintf("CHROME DINOSAUR GAME MODIFIED BY ROHIT TECH STUDY");
window(2,3,70,3);
cprintf("Press X to Exit, Press Space to Jump");
window(62,2,80,3);
cprintf("SCORE : ");
window(1,25,80,25);
for(int x=0;x<79;x++)
cprintf("?");
textcolor(0);
}
int t,speed=40;
void ds(int jump=0)
{
static int a=1;
if(jump==0)
t=0;
else if(jump==2)
t--;
else t++;
window(2,15-t,18,25);
cprintf(" ");
cprintf(" ?????? ");
cprintf(" ????????");
cprintf(" ????????");
cprintf(" ? ?????????");
cprintf(" ??? ????????? ");
cprintf(" ??????????????? ");
cprintf(" ????????? ");
if(jump==1 || jump==2)
{
cprintf(" ??? ?? ");
cprintf(" ?? ?? ");
}
else if(a==1)
{
cprintf(" ???? ??? ");
cprintf(" ?? ");
a=2;
}
else if(a==2)
{
cprintf(" ??? ?? ");
cprintf(" ?? ");
a=1;
}
cprintf(" ");
delay(speed);
}
void obj()
{
static int x=0,scr=0;
if(x==56 && t<4)
{
scr=0;
speed=40;
window(36,8,60,9);
cprintf("Game Over");
getch();
window(36,8,60,9);
cprintf(" ");
}
window(74-x,20,80-x,25);
cprintf("? ? ");
cprintf("? ? ");
cprintf("?????? ");
cprintf(" ? ");
cprintf(" ? " );
x++;
if(x==73)
{
x=0;
scr++;
window(70,2,80,3);
cprintf(" ");
window(70,2,80,3);
cprintf("%d",scr);
if(speed>20)
speed--;
}
}
void main()
{
char ch;
int i;
getup();
while(1){
while(!kbhit())
{
ds();
obj();
}
ch=getch();
if(ch==' ')
{
for(i=0;i<10;i++)
{
ds(1);
obj();
}
for(i=0;i<10;i++)
{
ds(2);
obj();
}
}
else if (ch=='x')
return;
}
}
helicopter c language programming
helicpoter c programming video
//_____________WELCOME ALL OF YOU ON ROHIT TECH STUDY CHANNEL______________//
//__________________ HOW TO MADE FLYING HELICOPTER IN C++ _________________//
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
/******** Animation *************/
void Helicopter();
void Letters();
void Go();
void Close();
void main()
{
clrscr();
int gd=DETECT, gm;
initgraph(&gd, &gm,"C://TC/BGI");
Letters();
Go();
Helicopter();
Close();
getch();
closegraph();
}
void Letters(){
for(int i=0;i<50;i++)
{
settextstyle(3,HORIZ_DIR,4);
outtextxy(70,100,"HELICOPTER IS READY TO TAKE-OFF...");
settextstyle(3,HORIZ_DIR,10);
outtextxy(250,200,"3");
settextstyle(3,HORIZ_DIR,2);
outtextxy(70,450,"PROGRAM MODIFIED BY ROHIT TECH STUDY");
setcolor(RED);
delay(30);
cleardevice();
}
for(int j=0;j<30;j++)
{
settextstyle(3,HORIZ_DIR,4);
outtextxy(70,100,"HELICOPTER IS READY TO TAKE-OFF...");
settextstyle(3,HORIZ_DIR,10);
outtextxy(250,200,"2");
settextstyle(3,HORIZ_DIR,2);
outtextxy(70,450,"PROGRAM MODIFIED BY ROHIT TECH STUDY");
setcolor(YELLOW);
delay(50);
cleardevice();
}
for(int k=0;k<20;k++)
{
settextstyle(3,HORIZ_DIR,4);
outtextxy(70,100,"HELICOPTER IS READY TO TAKE-OFF...");
settextstyle(3,HORIZ_DIR,10);
outtextxy(250,200,"1");
settextstyle(3,HORIZ_DIR,2);
outtextxy(70,450,"PROGRAM MODIFIED BY ROHIT TECH STUDY");
setcolor(GREEN);
delay(50);
cleardevice();
}
}
void Go() //This Go is only to make it stand for some time
{
for(int l=0;l<50;l++) //For Background
{
setcolor(10);
line(0,392,900,392); //Road
setcolor(3);
rectangle(0,392,180,300); //Garage
line(180,300,220,320);
line(220,320,220,390);
//.......mountain..............//
setcolor(7);
line(0,199,200,100);
arc(220,157,49,118,60);
line(259,112,460,300);
line(353,200,600,60);
arc(625,115,49,118,60);
//.......Sun...........//
setcolor(14);
arc(356,200,33,139,40);
line(327,169,300,140);
line(335,165,322,148);
line(345,162,327,129);
line(355,160,348,137);
line(365,161,367,124);
line(375,164,382,137);
line(381,168,410,134);
line(387,172,413,157);
setcolor(10);
settextstyle(7,0,2);
outtextxy(400,450,"-ROHIT TECH STUDY");
int b=0; //Speed of y-axis of helicoptor
int c=0; //Speed of x-axis of helicoptor
// ........Helicopter.............//
setcolor(11);
line(216+c,235-b,75+c,235-b);
line(115+c,247-b,120+c,240-b); //UpperBackSmallInclinedLine
line(166+c,247-b,161+c,240-b); //UpperFrontSmallInclinedLine
line(120+c,240-b,161+c,240-b); //UpperHorizontallLIne
line(139+c,240-b,139+c,235-b); //SmallBAckVerticalLIne
line(141+c,240-b,141+c,235-b); //SmallFrontVerticalLine
arc(141+c,272-b,140,180,40); //BackArc
arc(140+c,272-b,0,40,40); //FrontArc
line(165+c,248-b,165+c,266-b); //Glass
line(165+c,266-b,180+c,266-b); //Glass
rectangle(130+c,282-b,150+c,255-b); //Door
circle(147+c,268-b,1); //KeyHole
line(110+c,247-b,171+c,247-b); //MiddleLine
line(30+c,275-b,100+c,272-b); //backUpperLine
line(180+c,273-b,180+c,285-b); //frontArcVerticalLine
line(25+c,285-b,180+c,285-b); //BottomBigLine
line(30+c,275-b,20+c,260-b); //BackEndInclinedLine
line(20+c,260-b,14+c,260-b); //BackUpperLine
line(14+c,260-b,25+c,285-b); //LastEndInclinedLine
circle(18+c,262-b,1); //BackSmallCircle
//...........Legs...............//
setcolor(12);
line(80+c,299-b,167+c,299-b); //LowerBigLine
line(80+c,295-b,167+c,295-b); //UpperBigLine
line(80+c,295-b,80+c,299-b); //BackVerticalLine
arc(167+c,279-b,270,310,20); //LowerCurve
arc(167+c,275-b,270,310,20); //UpperCurve
line(180+c,291-b,180+c,293-b); //FrontSmallestLine
line(110+c,285-b,110+c,295-b); //StraightLine
line(113+c,285-b,113+c,295-b); //StraightLine
line(165+c,285-b,160+c,295-b); //VerticalLine
line(163+c,285-b,158+c,295-b);
setcolor(WHITE);
delay(30);
cleardevice();
}
}
//For Helicopter
void Helicopter()
{
for(int i=0;i<=350;i++)
{
int b=i; //Speed of y-axis of helicoptor
int c=i*2; /* Speed of x-axis of helicoptor.
It will move twice faster than y a-axis.*/
// Helicopter
setcolor(11);
line(115+c,247-b,120+c,240-b); //UpperBackSmallInclinedLine
line(166+c,247-b,161+c,240-b); //UpperFrontSmallInclinedLine
line(120+c,240-b,161+c,240-b); //UpperHorizontallLIne
line(139+c,240-b,139+c,235-b); //SmallBAckVerticalLIne
line(141+c,240-b,141+c,235-b); //SmallFrontVerticalLine
arc(141+c,272-b,140,180,40); //BackArc
arc(140+c,272-b,0,40,40); //FrontArc
line(165+c,248-b,165+c,266-b); //Glass
line(165+c,266-b,180+c,266-b); //Glass
rectangle(130+c,282-b,150+c,255-b); //Door
circle(147+c,268-b,1); //KeyHole
line(110+c,247-b,171+c,247-b); //MiddleLine
line(30+c,275-b,100+c,272-b); //backUpperLine
line(180+c,273-b,180+c,285-b); //frontArcVerticalLine
line(25+c,285-b,180+c,285-b); //BottomBigLine
line(30+c,275-b,20+c,260-b); //BackEndInclinedLine
line(20+c,260-b,14+c,260-b); //BackUpperLine
line(14+c,260-b,25+c,285-b); //LastEndInclinedLine
circle(18+c,262-b,1); //BackSmallCircle
//Legs
setcolor(12);
line(80+c,299-b,167+c,299-b); //LowerBigLine
line(80+c,295-b,167+c,295-b); //UpperBigLine
line(80+c,295-b,80+c,299-b); //BackVerticalLine
arc(167+c,279-b,270,310,20); //LowerCurve
arc(167+c,275-b,270,310,20); //UpperCurve
line(180+c,291-b,180+c,293-b); //FrontSmallestLine
line(110+c,285-b,110+c,295-b); //StraightLine
line(113+c,285-b,113+c,295-b); //StraightLine
line(165+c,285-b,160+c,295-b); //VerticalLine
line(163+c,285-b,158+c,295-b); //VerticalLine
//MovingWings
setcolor(15);
if(i%2==0)
{
line(141+c,235-b,75+c,243-b);
line(141+c,235-b,83+c,258-b);
line(141+c,235-b,164+c,278-b);
line(141+c,235-b,99+c,268-b);
line(141+c,235-b,196+c,243-b);
line(141+c,235-b,195+c,258-b);
}
else
{
line(141+c,235-b,71+c,236-b);
line(141+c,235-b,79+c,250-b);
line(141+c,235-b,110+c,278-b);
line(141+c,235-b,197+c,236-b);
line(141+c,235-b,196+c,250-b);
line(141+c,235-b,185+c,267-b);
line(141+c,235-b,141+c,282-b);
}
//BackGround image
//Road
setcolor(10);
line(0,392,900,392);
//Garage
setcolor(3);
rectangle(0,392,180,300);
line(180,300,220,320);
line(220,320,220,390);
//mountain
setcolor(7);
line(0,199,200,100);
arc(220,157,49,118,60);
line(259,112,460,300);
line(353,200,600,60);
arc(625,115,49,118,60);
//Sun
setcolor(14);
arc(356,200,33,139,40);
line(327,169,300,140);
line(335,165,322,148);
line(345,162,327,129);
line(355,160,348,137);
line(365,161,367,124);
line(375,164,382,137);
line(381,168,410,134);
line(387,172,413,157);
setcolor(10);
settextstyle(7,0,2);
outtextxy(400,450,"-ROHIT TECH STUDY");
delay(30);
cleardevice();
}
}
void Close()
{
settextstyle(7,HORIZ_DIR,8);
outtextxy(100,150,"Thank you");
}
airplane programming in c
//____________WELCOME ALL OF YOU ON ROHIT TECH STUDY CHANNEL_______________//
//_____________>>>> C PROGRAM TO DRAW AIRPLANE ANIMATION <<<<______________//
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <dos.h>
void drawplane(int);
int main(void)
{
int gdriver = DETECT, gmode, errorcode; // request auto detection
int i,k;
// initialize graphics and local variables
initgraph(&gdriver, &gmode,"c:\\tc\\bgi");
// read result of initialization
errorcode = graphresult();
// an error occurred
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
//diagram
for(i=1;i<getmaxcolor();i++)
{
setcolor(i);
drawplane(i);
outtextxy(420,220,"AIR");
outtextxy(450,218,"INDIA");
setcolor(11);
outtextxy(285,400,"MODIFIED BY---");
outtextxy(400,400,"ROHIT TECH STUDY");
for(k=0;k<900;k++)
{
setcolor(random(15));
outtextxy(random(k),random(175),".");
}
delay(800);
cleardevice();
}
// clean UP
getch();
closegraph();
return 0;
}
void drawplane(int n)
{
int i,j,k;
int poly[30];
line(145,220, 475,175);
arc(470,205,20,90,30);
ellipse(500,210, 270,95,15,15);
line(200,260,265,250);
line(350,240,500,225);
line(350,240,200,375);
line(200,375,175,380);
line(175,380,270,270);
line(270,270,270,260);
line(270,260,260,240);
line(260,240,340,230);
line(340,230,350,240);
line(340,230,195,375);
line(200,260,100,250);
line(100,250,100,230);
line(100,230,110,220);
line(110,225,90,150);
line(90,150,110,150);
line(110,150,150,225);
line(150,225,110,225);
line(95,170,105,170);
line(105,170,130,225);
line(105,245,60,275);
line(60,275,75,275);
line(75,275,150,245);
line(150,245,105,245);
line(115,245,65,275);
for(i=0,j=200,k=235;i<12;i++)
{
setcolor(n);
rectangle(j,k,j+10,k+5);
j=j+20;
if(j>200)
k=k-3;
}
setcolor(n);
rectangle(400,205,410,230);
poly[0]=487;
poly[1]=180;
poly[2]=470;
poly[3]=180;
poly[4]=475;
poly[5]=190;
poly[6]=495;
poly[7]=190;
drawpoly(4,poly);
}
//_______<<<<<<<____I HOPE YOU LIKE THIS PROGRAM_______>>>>>>>>>>>_________//watch airplane coding video
Featured Post
Happy Republic Day Wish Using HTML and CSS | 26 January wish using HTML/CSS
Happy Republic Day Wish Using HTML and CSS, 26 January wish using HTML/CSS <!-- WELCOME ALL OF YOU ON COMPUTER SOFT SKILLS CHANNEL -----...
Popular Posts
-
//...........WELCOE ALL OF YOU ON ROHIT TECH STUDY CHANNEL.................// //....>>>>>.......C++ PROGRAM TO DRAW HEART AN...
-
MOCING TRAIN PROJECT IN C++ LANGUAGE //.......... WELCOME ALL OF YOU ON ROHIT TECH STUDY CHANNEL................// //,,,,, ,,,,, C++ PROGRA...
-
3D CAR ANIMATION IN C++ LANGUAGE | C++ PROJECT Download source code // WELCOME ALL OF YOU ON ROHIT TECH STUDY CHANNEL // // Animated 3D Ca...
