sign up I login
 advanced
refer a friend - earn nickels!!

Ask & Discuss Questions with Community & Experts

Moderation Team
 90 chars left    advanced
Ask iit jee aieee pet cbse icse state board community Community Discussion Question: C++......
Forum Index -> Games, Puzzles and Quizzes like the article? email it to a friend.  
Author Message
avi_1214545 (974)

Blazing goIITian

Olaaa!! Perrrfect answer. 178  [220 rates]

avi_1214545's Avatar

total posts: 318    
offline Offline
herez mine




#include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
#include<bios.h>
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include<fstream.h>
#include<ctype.h>



int menu(int,int,int,char a[25],char b[25],char c[25],char d[25],char e[25],char sl1[2],char sl2[2],char title[40],char under[2]);
void lbyl(char a[50]);
void graph();
void words(char a[25],char b[30]);
void graph();
void main_menu();
void student_menu();
void updown();
void man();
void mark_menu();
int records=0;

void words(char a[25],char b[30])
{
setcolor(YELLOW);
settextstyle(7,0,6);
outtextxy(100,100,a);
for(int ff=10;ff<255;ff++)
{
settextstyle(10,0,5);
setcolor(LIGHTGREEN );
outtextxy(ff*24,85,"ÛÛÛÛÛ.");
setcolor(BLACK);
delay(1);
outtextxy(ff*24 ,85,"ÛÛÛÛÛ.");
}
setcolor(YELLOW);
settextstyle(7,0,6);
outtextxy(100,100,a);
settextstyle(7,0,6);
delay(500);
setcolor(LIGHTGREEN);
outtextxy(100,100,a);
setcolor(YELLOW);
settextstyle(7,0,6);
outtextxy(70,180,b);
for(ff=10;ff<255;ff++)
{
settextstyle(10,0,5);
setcolor(LIGHTGREEN );
outtextxy(ff*24,170,"ÛÛÛÛÛ.");
setcolor(BLACK);
delay(1);
outtextxy(ff*24 ,170,"ÛÛÛÛÛ.");
}
setcolor(YELLOW);
settextstyle(7,0,6);
outtextxy(70,180,b);
settextstyle(7,0,6);
delay(500);
setcolor(LIGHTGREEN);
outtextxy(70,180,b);
setcolor(RED);
for(int li=70;li<600;li++)
{
delay(4);
outtextxy(li,194,".");
}
while(!kbhit())
{
settextstyle(11,0,2);
for(int bv=10;bv<255;bv++)
{
setcolor(LIGHTGREEN);
outtextxy(bv*4,300,"ÛÛÛÛ");
setcolor(BLACK);
delay(2);
outtextxy(bv*4 ,300,"ÛÛÛÛ");
}
settextstyle(11,0,2);
setcolor(GREEN);
outtextxy(400+50,300,"Press Any Key");
delay(300);
setcolor(LIGHTGREEN);
outtextxy(400+50,300,"Press Any Key");
setcolor(RED);
outtextxy(510+50,300,">");
delay(80);
outtextxy(515+50,300,">");
delay(80);
outtextxy(520+50,300,">");
setcolor(GREEN);
outtextxy(510+50,300,">");
delay(80);
outtextxy(515+50,300,">");
delay(80);
outtextxy(520+50,300,">");
}
}

void lbyl(char a[50])
{
int l,i;
l=strlen(a);
for (i=0;i {
delay(350);
cout< }
}

void fx()
{
clrscr();
graph();
int i,y;
for(int x=640;x>=0;x--) //Design
{
y=x>>1;
setcolor(14);
rectangle(x,y,619-x,469-y);
setcolor(0);
rectangle(x+1,y+1,619-x-1,469-y-1);
delay(5);
if(x==639)
{
gotoxy(31,13);
lbyl("Rituraj Yadav");
gotoxy(38,15);
lbyl("Presents");
gotoxy(29,17);
lbyl("Students Information System");
delay(900);
}
}
for ( i=0 ; i<2000; ++i ) //Put Stars
{
putpixel(random(620), random(460), random( 16-1 )+1);
delay(1);
}
delay(1000);
clrscr();
graph();
x=7;
y=16;
for(i=0;i<2000;i++)
putpixel(random(640),random(480),random(15)+1);
settextstyle(7,0,7);
setcolor(16);
delay(1200);
for(i=-10;i<=150;i+=2)
{
setcolor(x);
outtextxy(i,100,"WEL");
setcolor(y);
if(i<150)
outtextxy(i,100,"WEL");
}
for(i=600;i>=330;i-=2)
{
setcolor(x);
outtextxy(i,100,"OME");
setcolor(y);
if(i>330)
outtextxy(i,100,"OME");
}
for(i=-20;i<=100;i+=4)
{
setcolor(x);
outtextxy(290,i,"C");
setcolor(y);
if(i<100)
outtextxy(290,i,"C");
}
delay(1500);
setcolor(16);
for(i=-10;i<=370;i=i+2)
{
setcolor(x);
outtextxy(i,200,"T");
setcolor(y);
if(i<370)
outtextxy(i,200,"T");
}
for(i=600;i>400;i=i-2)
{
setcolor(x);
outtextxy(i,200,"O");
setcolor(y);
if(i>400)
outtextxy(i,200,"O");
}
setcolor(x);
outtextxy(400,200,"O");
delay(2500);
clearviewport();
settextstyle(7,0,7);
setbkcolor(RED);
for(i=-10;i<316;i++)
{
setcolor(1);
outtextxy(i,100,"STUDENT");
setcolor(16);
if(i<316)
outtextxy(i,100,"STUDENT");
}
for(i=460;i>220;i--)
{
setcolor(2);
outtextxy(100,i,"INFORMATION");
setcolor(16);
if(i>220)
outtextxy(100,i,"INFORMATION");
}
for(i=600;i>150;i--)
{
setcolor(5);
outtextxy(i,350,"SYSTEM");
setcolor(16);
if(i>150)
outtextxy(i,350,"SYSTEM");
}
closegraph();
}


void message(int x,int y,int lines,char a[50],char b[50],char c[50],char d[50],char e[50],char f[10],int back)
{
int l,i,j;
char f1[10];
l=strlen(a);
if(l l=strlen(b);
if(l l=strlen(c);
if(l l=strlen(d);
if(l l=strlen(e);
if(l l=strlen(f);
l+=4;

textbackground(back);
for(i=1;i for(j=1;j {
gotoxy(i+x,j+y);
cputs(" ");
}
gotoxy(x,y);
cputs("É");
for(i=x+1;i {
gotoxy(i,y);
cputs("Í");
gotoxy(i,y+lines+3);
cputs("Í");
}
gotoxy(x+1+l,y);
cputs("»");

for(i=y+1;i {
gotoxy(x,i);
cputs("º");
gotoxy(x+l+1,i);
cputs("º");
}
gotoxy(x,y+lines+3);
cputs("È");
gotoxy(x+l+1,y+lines+3);
cputs("¼");

j=l-strlen(a);
j=j/2;
gotoxy(j+x+1,++y);
cputs(a);
j=l-strlen(b);
j=j/2;
gotoxy(x+j+1,y+1);
cputs(b);
j=l-strlen(c);
j=j/2;
gotoxy(x+j+1,2+y);
cputs(c);
j=l-strlen(d);
j=j/2;
gotoxy(x+j+1,3+y);
cputs(d);
j=l-strlen(e);
j=j/2;
gotoxy(x+j+1,4+y);
cputs(e);
j=l-strlen(f)-3;
j=j/2;
gotoxy(x+j+1,y+lines+1);
strcat(f1," ");
strcat(f1,f);
strcat(f1," ");
textbackground(BLACK);
cputs(f1);
textcolor(BLACK);
for(i=0;i {
gotoxy(x+l+2,i+y);
cputs("Û");
}
for(i=1;i {
gotoxy(x+i,y+lines+3);
cputs("ß");
}
}

struct s_date
{
int dd,mm,yyyy;
};

//DEFINING OF Stuctures
struct student
{
char address[30];
char fname[30];
int redgno;
s_date dob;
char clas[5];
char name[20];
int sub1,sub2,sub3,sub4,sub5,total;
float avg,pre;
char div[10];
char st_code[10];
}s[10];

//Function To Add Data
void add()
{
textbackground(16);
textcolor(7);
int i=0;
char ch='y';
char fn[20];
fstream file;
do
{
records++;
ss:
clrscr();
int st;
int t_redg,mark;
gotoxy(20,2);
cout<<"Students Data Collector";
gotoxy(20,3);
cout<<"=======================";
gotoxy(19,7);
cout<<"Enter The Following";
gotoxy(19,8);
cout<<"Registaration No:";gotoxy(36,8);cin>>t_redg;
s[i].redgno=t_redg;
gotoxy(20,10);
cout<<"Name :";gotoxy(35,10);gets(s[i].name);
gotoxy(20,12);
cout<<"Address :";gotoxy(35,12);gets(s[i].address);
gotoxy(20,14);
cout<<"Father's Name :";gotoxy(35,14);gets(s[i].fname);
gotoxy(20,16);
cout<<"Class :";gotoxy(35,16);gets(s[i].clas);
gotoxy(20,18);
cout<<"Date Of Birth :DD MM YYYY";gotoxy(35,18);
cin>>s[i].dob.dd>>s[i].dob.mm>>s[i].dob.yyyy;

sa:
clrscr();
gotoxy(20,2);
cout<<"Student Data Entry Form";
gotoxy(20,3);
cout<<"=======================";
gotoxy(10,7);
cout<<"Enter The Stream Code: 1.Science Stream 2.Commerce Streame";
gotoxy(32,7);
cin>>st;
switch(st)
{
case 1: strcpy(s[i].st_code,"Science"); break;
case 2: strcpy(s[i].st_code,"Commerce"); break;
default: cout<<" Invalid Type... Do you want to continue?(Y/N)...";
cin>>ch;
if (ch=='y'||ch=='Y')
{
clrscr();
goto sa;
}
else
add();
}

clrscr();
gotoxy(20,2);
cout<<"Student Data Entry Form";
gotoxy(20,3);
cout<<"=======================";
gotoxy(10,5);
cout<<"Enter The Following Marks";
gotoxy(10,10);
cout<<"Sub1(Eng/Eng):"; //Sub 1
gotoxy(30,10);
cin>>s[i].sub1;
gotoxy(10,12);
cout<<"Sub2(Math/A/C):"; //Sub 2
gotoxy(30,12);
cin>>s[i].sub2;
gotoxy(10,14);
cout<<"Sub3(Phy/Entrp.):"; //Sub 3
gotoxy(30,14);
cin>>s[i].sub3;
gotoxy(10,16);
cout<<"Sub4(Chem/B.st):"; //Sub 4
gotoxy(30,16);
cin>>s[i].sub4;
gotoxy(10,18);
cout<<"Sub5(Comp/IP):"; //Sub 5
gotoxy(30,18);
cin>>s[i].sub5;
s[i].total=s[i].sub1+s[i].sub2+s[i].sub3+s[i].sub4+s[i].sub5;
if((s[i].sub1<33)||(s[i].sub2<33)||(s[i].sub3<33)||(s[i].sub4<33)||(s[i].sub5<33))
strcpy(s[i].div,"Fail");
else if(s[i].total>=375)
strcpy(s[i].div,"Distinction");
else if((s[i].total>=300)&&(s[i].total<375))
strcpy(s[i].div,"First Class");
else if((s[i].total>=250)&&(s[i].total<300))
strcpy(s[i].div,"Second Class");
else if(s[i].total<165)
strcpy(s[i].div,"Fail");
strcat(fn,s[i].name);
strcat(fn,".txt");
file.open(fn,ios::out);
if(!file)
{
gotoxy(25,79);
cout<<".";
}
file<<" Report Card Of "< <<" Registration Number:"< <<" Address:"< <<" Date Of Birth:"< <<" Stream:"<-------------------------------------------------------------------------------
Subject Marks ------------- Subject 1 :"
< <<" Subject 4 :"< <<" Total :"< file.close();

i++;
gotoxy(10,22);
cout<<"Want More Record To Be Written?(Y/N)......";
cin>>ch;
}while(ch=='y'||ch=='Y');
if(ch=='n'||ch=='N')
student_menu();
}

//Function To Modify Marks
void mod()
{
int regno,flag=0,i;
char ch;
student te;
clrscr();
cout<<" Enter The Reg No to be modified:";
cin>>regno;
for(i=0;i<10;i++)
{
if(s[i].redgno==regno)
{
flag=1;
cout<<" Subject 1 :"< cout<<" Do you want to change this?[y/n]";
ch=getch();
if(ch=='y')
{
cout<<" Enter New Value:";
cin>>te.sub1;
s[i].sub1=te.sub1;
}
cout<<" Subject 2 :"< cout<<" Do you want to change this?[y/n]";
ch=getch();
if(ch=='y')
{
cout<<" Enter New Value:";
cin>>te.sub2;
s[i].sub2=te.sub2;
}
cout<<" Subject 3 :"< cout<<" Do you want to change this?[y/n]";
ch=getch();
if(ch=='y')
{
cout<<" Enter New Value:";
cin>>te.sub3;
s[i].sub3=te.sub3;
}
cout<<" Subject 4 :"< cout<<" Do you want to change this?[y/n]";
ch=getch();
if(ch=='y')
{
cout<<" Enter New Value:";
cin>>te.sub4;
s[i].sub4=te.sub4;
}
cout<<" Subject 5 :"< cout<<" Do you want to change this?[y/n]";
ch=getch();
if(ch=='y')
{
cout<<" Enter New Value:";
cin>>te.sub5;
s[i].sub5=te.sub5;
}
}
}
if(flag==0)
cout<<"Invalid Reg No!";
}

//Function To View Help
void help()
{
clrscr();
textcolor(WHITE);
message(12,8,6,"This Software is designed for aiding schools in",
"keeping records of students and thier information.",
"This software is a interactive menu driven program.",
"This program will create a file with students name ",
"with all his infomation","OK",LIGHTGRAY);
gotoxy(15,14);
textcolor(WHITE);
textbackground(LIGHTGRAY);
cputs(" Keys: -Up, -Down,Enter-Selecting,Esc-To Exit.");
getch();
textcolor(BLACK);
main_menu();
}

//Function To Show Credits
void updown()
{
int i;
textcolor(GREEN);
for (i=25;i>10;i--)
{
delay(180);
clrscr();
gotoxy(30,i);
cputs("PROGRAMER");
gotoxy(30,i+2);
cputs("Rituraj Yadav");
gotoxy(30,5+i);
cputs(" ");
}
//delay(800);
}

//Function To Initialize Graphics
void graph()
{
int graphdriver = DETECT, graphmode;
initgraph(&graphdriver, &graphmode, "");
}

//Function To Make Menus
int menu(int xi,int y,int num,char a[25],char b[25],char c[25],char d[25],char e[25],char sl1[2],char sl2[2],char title[40],char under[2])
{
char ch;
int key,x=4,sl=1,l,i;
clrscr();
l=strlen(title);
gotoxy(xi,y-2);
cout< cout<<" ";
gotoxy(xi,y-1);
for(i=0;i cout< gotoxy(xi,y);
cout< gotoxy(xi,y+1);
cout<<" "< gotoxy(xi,y+2);
cout<<" "< gotoxy(xi,y+3);
cout<<" "< gotoxy(xi,y+4);
cout<<" "< gotoxy(xi,y+num+1);
cout<<"Enter Your Choice: ";
key=bioskey(0);
while (key!=7181)
{
switch(key)
{
case 18432: clrscr(); //UP
l=strlen(title);
gotoxy(xi,y-2);
cout< cout<<" ";
gotoxy(xi,y-1);
for(i=0;i cout< switch(x)
{
case 4: if (num==4)
goto up4;
else
if (num==3)
goto up3;
else
if (num==2)
goto up2;
gotoxy(xi,y);
cout<<" "< gotoxy(xi,y+1);
cout<<" "< gotoxy(xi,y+2);
cout<<" "< gotoxy(xi,y+3);
cout<<" "< gotoxy(xi,y+4);
cout< gotoxy(xi,y+num+1);
cout<<"Enter Your Choice:5";sl=5;
if (num==5) x=2;
else x=1;
break;
case 2: up4:
gotoxy(xi,y);
cout<<" "< gotoxy(xi,y+1);
cout<<" "< gotoxy(xi,y+2);
cout<<" "< gotoxy(xi,y+3);
cout< gotoxy(xi,y+4);
cout<<" "< gotoxy(xi,y+num+1);
cout<<"Enter Your Choice:4";sl=4;
if (num==5)
x=3;
else
if (num==4)
x=3;
else
x=1;
break;
case 3: up3:
gotoxy(xi,y);
cout<<" "< gotoxy(xi,y+1);
cout<<" "< gotoxy(xi,y+2);
cout< gotoxy(xi,y+3);
cout<<" "< gotoxy(xi,y+4);
cout<<" "< x=1;
break;
case 1: up2:
gotoxy(xi,y);
cout<<" "< gotoxy(xi,y+1);
cout< gotoxy(xi,y+2);
cout<<" "< gotoxy(xi,y+3);
cout<<" "< gotoxy(xi,y+4);
cout<<" "< gotoxy(xi,y+num+1);
cout<<"Enter Your Choice:2";sl=2;
if (num==5)
x=5;
else
if (num==2)
x=5;
else
x=5;
break;
case 5: gotoxy(xi,y);
cout< gotoxy(xi,y+1);
cout<<" "< gotoxy(xi,y+2);
cout<<" "< gotoxy(xi,y+3);
cout<<" "< gotoxy(xi,y+4);
cout<<" "< gotoxy(xi,y+num+1);
cout<<"Enter Your Choice:1";sl=1;
if (num==5)
x=4;
else
if (num==2)
x=1;
else
if (num==3)
x=3;
else
if (num==4)
x=2;
break;
default: cout<<"Wrong!!2"< }
break;
case 20480: clrscr(); //DOWN
l=strlen(title);
gotoxy(xi,y-2);
cout< cout<<" ";
gotoxy(xi,y-1);
for(i=0;i cout< switch(x)
{
case 1: gotoxy(xi,y);
cout<<" "< x=5;
break;
case 2: gotoxy(xi,y);
cout<<" "< if (num==4)
x=5;
else
x=1;
break;
case 3: gotoxy(xi,y);
cout<<" "< if (num==5)
x=2;
else
if (num==3)
x=5;
else
x=2;
break;
case 4: gotoxy(xi,y);
cout<<" "< if (num==5)
x=3;
else
if (num==2)
x=5;
else
x=3;
break;
case 5: gotoxy(xi,y);
cout< if (num==5)
x=4;
else
if (num==2)
x=4;
else
x=4;
break;
default: cout<<"Wrong!!2"< }
break;
case 283: sl=6; goto end;
case 561: sl=1; goto end;
case 818: sl=2;goto end;
case 1075: sl=3;goto end;
case 1332: sl=4;goto end;
case 1589: sl=5;goto end;
case 1846: sl=6;goto end;
case 7181: goto end;
default: break;
}
key=bioskey(0);
}
end:
return sl;
}

//Final Screen
void man()
{
int d=DETECT,m,i;
initgraph(&d,&m," ");
settextstyle(7,0,7);
randomize();
for(i=0;i<5800;i++)
putpixel(random(800),random(600),random(15)+1);
outtextxy(10,150," See you again!");
getch();
closegraph();
}

//Menus
//Menu To View Marks
void view()
{
int opt,i,reg,flag=0;
char n[20],ch;
view:
opt=menu(1,5,5,"1.View All","2.Search Reg No","3.Show Failers","4.Read From File" ,"5.Back","[","]", "Dispay Menu","=");
switch(opt)
{
case 1: //Show All Marks
for(i=0;i<10;i++)
{
clrscr();
if(s[i].redgno!=NULL)
{
cout<<" Report Card Of "< cout<<" Press Any Key To Continue..";
getch();
}
else
break;
}
break;
case 3: clrscr(); //Show Failers
for(i=0;i {
if((s[i].sub1<33)||(s[i].sub2<33)||(s[i].sub3<33)||(s[i].sub4<33)||(s[i].sub5<33))
{
cout<<" Report Card Of "< cout<<" Press Any Key To Continue...";
flag=1;
getch();
}
}
if(flag==0)
{
cout<<"No Failers Found";
getch();
view();
}
break;
case 2: clrscr(); //Search By Reg No
cout<<" Enter Number To Be Searched:";cin>>reg;
for(i=0;i<10;i++)
{
if(s[i].redgno==reg)
{
cout<<" Report Card Of "< flag=1;
getch();
}
}
if(flag==0)
{
cout<<"Record Not Found";
getch();
view();
}
break;
case 4: //Read File
clrscr();
cout<<" Enter Name Of Student:";gets(n);
ifstream fil;
strcat(n,".txt");
fil.open(n);
while(!fil.eof())
{
fil.get(ch);
cout< }
cout<<" Press Any Key To Continue...";
getch();
break;
case 5: student_menu(); //Exit
default: student_menu();
}
goto view;
}

//Student Menu
void student_menu()
{
textbackground(16);
textcolor(15);
unsigned int tredg;
char ch='y',ch1;
do
{
clrscr();
ch1=menu(1,5,3,"1.Add Students","2.Display Student","3.Back","","","[","] ","Student Menu","=");
switch(ch1)
{
case 1: clrscr(); //Marks
add();
break;
case 2: clrscr(); //View Marks
view();
break;
case 3: main_menu(); //Main Menu
getch();
break;
case 6: main_menu(); //Main Menu
getch();
break;
default: cout<<" Worng Choice!!";
}
cout<<" Do You Want to Continue?(Y/N)";
cin>>ch;
}
while(ch=='y'||ch=='Y');
main_menu();
}

//Main Menu
void main_menu()
{
textbackground(16);
textcolor(LIGHTGRAY);
char ch1;
do
{
clrscr();
ch1=menu(1,5,4,"1. Students Details","2. Modify Students","3. Help","4. Exit",""," [","]","Student Information System","=");
switch(ch1)
{
case 1: clrscr(); //Student Menu
student_menu();
break;
case 2: clrscr(); //Marks Menu
mark_menu();
break;
case 3: help();
break;
case 4: clrscr(); //Exit
updown();
man();
exit(0);
break;
case 6: clrscr(); //Exit
break;
default: cout<<" Worng Choice!!";
}
}while(ch1==4);
}

//Marks Menu
void mark_menu()
{
textbackground(BLACK);
textcolor(WHITE);
int t_redg,i,opt,flag=0;
char ch='y',na[20];
do
{
clrscr();
gotoxy(1,25);
cout<<"Press Esc to Quit";
opt=menu(1,5,3,"1.Modify Student","2.Remove Student","3.Back","",""," [","] "," Menu","=");
switch(opt)
{
case 1: clrscr(); //Modify Student
mod();
getch();
mark_menu();
break;
case 2: clrscr(); //Delete Student
cout<<"Which Student Do you want to Delete Enter Reg No:";
cin>>t_redg;
for(i=0;i<10;i++)
{
if(s[i].redgno==t_redg)
{
strcat(na,s[i].name);
strcat(na,".txt");
remove(na);
cout<<"The Record of "< flag=1;
break;
}
}
if(flag==0)
cout<<"Record not found";
mark_menu();
break;
default: main_menu();
}
gotoxy(30,25);
cout<<"Do you want to Continue?(Y/N)...";
cin>>ch;
}while(ch=='y'||ch=='Y');
if(ch=='n'||ch=='N')
main_menu();
}

//Main Function
void main()
{
clrscr();
fx();
clrscr();
main_menu();
getch();
}

//End


Na pine ka shouk tha na pilane ka shonk tha. Hume to sirf NAZREIN milane ka shonk tha. Par kya karen hum nazre hi unse mila baithe jinhe nazron se PILANE ka shonk tha.
 this reply: 10 points  (with Olaaa!! Perrrfect answer.   in 2 votes )   [?]
 
You have to be logged on to rate
  
Selvaganesh_i (273)

Hot goIITian

Olaaa!! Perrrfect answer. 47  [66 rates]

Selvaganesh_i's Avatar

total posts: 141    
offline Offline
/* Bouncing Ball */

# include <graphics.h>
# include <dos.h>

void main(void)
{
    int gdriver = DETECT, gmode,imgsize = 32;
    void *greenball,*blueball;
    int x,y,winminx = 16,winminy = 16,winmaxx,winmaxy,xi = 1,yi = 1,hit,ballcolor;
    unsigned int size;

    initgraph(&gdriver, &gmode, "\\tc\\bgi");
    winmaxx = getmaxx() - 16;
    winmaxy = getmaxy() - 16;
    size = imagesize(0,0,imgsize,imgsize);

    //Draw the window
    setcolor(RED);
    rectangle(winminx - 1,winminy - 1,winmaxx + 1,winmaxy + 1);
    setfillstyle(1,LIGHTGRAY);
    floodfill(winminx,winminy,RED);

    //Draw the green ball
    setcolor(WHITE);
    circle(winminx + 16,winminy + 16,15);
    setfillstyle(1,GREEN);
    floodfill(winminx + 16,winminy + 16,WHITE);

    //copy the green ball to memory
    greenball = (void*)malloc(size);
    getimage(winminx,winminy,winminx + imgsize,winminy + imgsize,greenball);

    //Draw the blue ball
    setfillstyle(1,BLUE);
    floodfill(winminx + 16,winminy + 16,WHITE);

    //copy the blue ball to memory
    blueball = (void*)malloc(size);
    getimage(winminx,winminy,winminx + imgsize,winminy + imgsize,blueball);

    outtextxy(250,6,"Bouncing Ball");
    x = winminx, y = winminy;
    putimage(x,y,greenball,0);
    hit = 0;
    ballcolor = GREEN;
    while (!kbhit())
    {
        x += xi, y += yi;
        if(hit)
        {
            hit = 0;
            if (ballcolor == GREEN) ballcolor = BLUE;
            else if (ballcolor == BLUE) ballcolor = GREEN;
        }
        if(ballcolor == GREEN) putimage(x,y,greenball,0);
        else if(ballcolor == BLUE) putimage(x,y,blueball,0);

        delay(4), nosound();
        if(y + imgsize == winmaxy) hit = 1, yi = -1, sound(60);
        if(x + imgsize == winmaxx) hit = 1, xi = -1, sound(60);
        if(y == winminy) hit = 1, yi = 1, sound(60);
        if(x == winminx) hit = 1, xi = 1, sound(60);
    }
    closegraph();
}





 this reply: 5 points  (with Olaaa!! Perrrfect answer.   in 1 votes )   [?]
 
You have to be logged on to rate
  
Selvaganesh_i (273)

Hot goIITian

Olaaa!! Perrrfect answer. 47  [66 rates]

Selvaganesh_i's Avatar

total posts: 141    
offline Offline
# include <stdio.h>
# include <alloc.h>

void main()
{
    int size,start,i,j;
    int *mat[50];
    int row,col,sum,count;

    clrscr();
    printf("\nEnter the size: ");
    scanf("%d",&size);
    for(i = 0;i < size;i++)
        mat[i] = (int*) malloc(size * sizeof(int));
    printf("\nEnter the starting number: ");
    scanf("%d",&start);
    sum = size * (((size*size + 1) / 2) + (start - 1));
    printf("\nThe sum of numbers in any direction is: %d \n",sum);
    row = 1;
    col = (size + 1) / 2;
    for(i = 1;i <= size*size;i++)
    {
        mat[row][col] = start++;
        if(i % size == 0) row++;
        else
        {
            if(--row < 1)    row = size;
            if(++col > size) col = 1;
        }
    }
    for(i = 1;i <= size;i++)
    {
        for(j = 1;j <= size;j++)
            printf("%3d ",mat[i][j]);
        printf("\n");
    }
    getch();
}




 this reply: 5 points  (with Olaaa!! Perrrfect answer.   in 1 votes )   [?]
 
You have to be logged on to rate
  
Selvaganesh_i (273)

Hot goIITian

Olaaa!! Perrrfect answer. 47  [66 rates]

Selvaganesh_i's Avatar

total posts: 141    
offline Offline
/* PLANE */

# include<graphics.h>
# include<conio.h>
# include<dos.h>

void plane(int x,int y)
{
  line(x,y,x+10,y-3);
  line(x+10,y-3,x+25,y-2);
  line(x+25,y-2,x+29,y-7);
  line(x+29,y-7,x+27,y);
  line(x+27,y,x,y);
  line(x+11,y-1,x+15,y-1);
 }
 void main()
 {
    int driver,mode;
    driver=DETECT;
     initgraph(&driver,&mode,"\tc\bgi");
     setfillstyle(SOLID_FILL,RED);
     bar(0,0,640,480);
     for(int i=400;i+600>0;i-=5)
     {
        delay(200);
        setfillstyle(SOLID_FILL,RED);
        bar(0,0,640,480);
        setfillstyle(SOLID_FILL,YELLOW);
        fillellipse(88,15,12,9);
        plane(i,10);
        plane(i+15,30);
        plane(i+50,30);
        plane(i+70,70);
        plane(i+90,90);
        outtextxy(i,50,"LET THEM BE BIRDS AND NOT WAR PLANES...");
     }
     getch();
     closegraph();
     }







 this reply: 5 points  (with Olaaa!! Perrrfect answer.   in 1 votes )   [?]
 
You have to be logged on to rate
  
lakshmis.kvasn (10)

Cool goIITian

Olaaa!! Perrrfect answer. 2  [2 rates]

lakshmis.kvasn's Avatar

total posts: 68    
offline Offline
THAT IDEA WAS VERY USEFUL!!!!!!! Brilliant!!!!!!!! THANKS!!!!!!!!!!!!!!!!!
 this reply: 0 points  (with Olaaa!! Perrrfect answer.   in 0 votes )   [?]
 
You have to be logged on to rate
  
v_gurucharan (283)

Blazing goIITian

Olaaa!! Perrrfect answer. 47  [71 rates]

v_gurucharan's Avatar

total posts: 460    
offline Offline
http://www.goiit.com/posts/list/games-puzzles-and-quizzes-c-43488.htm

Stay Hungry. Stay Foolish.
 this reply: 0 points  (with Olaaa!! Perrrfect answer.   in 0 votes )   [?]
 
You have to be logged on to rate
  
pratu (162)

Blazing goIITian

Olaaa!! Perrrfect answer. 28  [39 rates]

pratu's Avatar

total posts: 688    
offline Offline
Keep this thread alive................. Pls post more and more............... :)

My thinking about life :::::

"LIFE ENDS WHEN U STOP DREAMING,
HOPE ENDS WHEN U STOP BELIEVING,
LOVE ENDS WHEN U STOP CARING,
SO "DREAM,CARE AND LOVE"
BCOZ LIFE IS BEAUTIFUL......"
[url=http://sig.graphicsfactory.com/]

[/url]
Glitter Graphics






 this reply: 0 points  (with Olaaa!! Perrrfect answer.   in 0 votes )   [?]
 
You have to be logged on to rate
  
adi_dev (181)

Hot goIITian

Olaaa!! Perrrfect answer. 33  [41 rates]

adi_dev's Avatar

total posts: 137    
offline Offline

//Animated 3D Car


#include<graphics.h>




#include<conio.h>




#include<dos.h>




#include<stdlib.h>




#include<process.h>






void main()




{




   int gd=DETECT,gm;




   initgraph(&gd,&gm,"d:\\tc\\bgi");




int c=12;




setbkcolor(0);




//setlinestyle(0,1,2);




int t;




while(1)




{




settextstyle(2,0,5);




outtextxy(100,10,"Press L,H ,T,P");




outtextxy(100,30,"Press 1 for Quit");




as:




setcolor(13);




ellipse(380,127,20,152,130,35);




//////////////////////////////rear//////////////////////////






line(490,109,560,142);




line(560,142,569,142);




line(569,142,582,102);




line(582,102,620,92);




line(593,132,617,125);






line(617,124,627,96);




line(620,92,628,97);






line(472,86,602,96);




line(501,113,575,121);




line(443,77,475,80);






line(443,77,432,93);




line(475,80,472,85);




//setcolor(4);




   line(593,132,593,137);




   line(593,137,600,141);




   line(600,141,600,185);




   line(600,185,608,192);




   line(608,192,608,234);




   line(608,234,586,253);




    line(586,253,577,248);






/////////////////////////           mirror




   line(263,112,363,127);




      line(193,160,263,112);




   line(193,160,220,170);




      line(220,170,280,180);




      line(280,180,320,185);




      line(320,185,363,127);




////////////////////////////////sidemirror




line(340,194,460,169);




 line(460,169,519,152);






ellipse(512,144,300,30,10,10);




ellipse(467,143,28,100,50,30);




line(510,128,521,138);




line(435,116,440,171);






//   setcolor(4);          




////////////////////////////////////////cont//




   line(339,194,372,144);




//    line(372,140,386,128);




ellipse(454,208,87,123,128,95);




line(372,144,384,128);




   int b,x,y;




////////////////////////lower




line(365,298,524,264);




line(365,298,330,310);




line(330,310,323,310);








///////////////////////////////bumper




ellipse(162,221,135,190,90,40);




line(96,193,140,174);




line(140,174,160,168);




line(160,168,192,161);






//////////////////////front




ellipse(75,246,95,190,18,18);




line(57,251,57,286);




//setcolor(4);




ellipse(181,178,232,263,200,137);




ellipse(195,180,256,286,200,137);








ellipse(191,171,228,247,200,100);




ellipse(231,198,234,275,200,80);






//setcolor(9);




//ellipse(195,170,256,286,200,137);




//setcolor(12);






ellipse(196,167,228,246,200,90);




ellipse(231,184,234,276,200,80);








ellipse(191,200,228,246,200,90);




ellipse(228,218,234,276,200,80);






ellipse(258,268,180,220,200,40);




ellipse(178,296,244,355,16,10);






ellipse(238,249,227,250,200,60);








/////////////wheel1




ellipse(302,281,320,77,26,45);




ellipse(290,277,65,162,40,45);




ellipse(278,288,144,212,31,45);






/////////////wheel2




//setcolor(5);




ellipse(302+260,229,328,87,26,45);




ellipse(290+280-7,277-50+2,90,162,40,45);




ellipse(278+270,288-50,144,215,27,45);




 b=0;




int v=0;






/////////




ellipse(302+250+v,227+b,295,90,29,41);




ellipse(302+234+v,231+b,245,306,50,40);




//setlinestyle(3,0,3);




ellipse(302+248+v,229+b,0,360,21,30);






ellipse(302+247+v,229+b,0,360,8,10);




setfillstyle(6,11);




//floodfill(302+248+v,230+b,13);




//line(546,201,546,257);




//line(554,201,554,257);




//setcolor(4);






line(546+v,201+b,546+v,220+b);




line(551+v,201+b-2,551+v,220+b);






line(546+v,238+b,546+v,257+b);




line(551+v,238+b+2,551+v,257+b+2);








line(530+v,225+b,541+v,225+b);




line(530+v,230+b,541+v,230);






line(557+v,225+b,570+v,225+b);




line(557+v,230+b,570+v,230+b);










line(563+v,206+b,552+v,222+b);




line(534+v,246+b,543+v,232+b);






line(566+v,210+b,556+v,223+b);




line(536+v,250+b,544+v,238+b);






line(536+v,207+b,546+v,222+b);




line(532+v,213+b,542+v,224+b);






line(556+v,235+b,566+v,247+b);




line(551+v,237+b,563+v,253+b);










////////////////////////////////////////////////////




v=-260;




b=56;




ellipse(302+233+v,221+b,260,60,49,51);




//ellipse(302+234+v,231+b,245,306,50,40);




//setlinestyle(3,0,3);




ellipse(302+243+v,224+b,0,360,28,35);




//  line(249,328,269,328);




ellipse(300+245+v,223+b,0,360,10,12);






ellipse(285+249+v,239+b,210,260,30,33);




//floodfill(285+258+v,230+b,12);




b=45;




v=v-4;




line(546+v,201+b,546+v,220+b+2);




line(551+v,201+b,551+v,220+b+2);




b=b+8;




line(546+v,238+b,546+v,257+b+4);




line(551+v,238+b,551+v,257+b+4);




v=v-2;




line(530+v-6,225+b,541+v,225+b);




line(530+v-6,230+b,541+v,230+b);




v=v+5;




line(557+v,225+b,570+v+3,225+b);




line(557+v-1,230+b,570+v+3,230+b);








b=b-5;




v=v-5;




line(565+v+3,206+b,552+v+4,222+b-2);




b=b+15;






line(534+v,246+b,543+v+3,232+b-5);




b=b-10;




line(566+v+7,210+b-5,556+v+4,220+b);




line(536+v-5,250+b,544+v-2,238+b-4);








line(536+v,207+b-8,545+v,222+b-5);




line(531+v,212+b-8,542+v,224+b-2);






line(556+v,235+b,566+v+3,247+b+5);




line(551+v,237+b,563+v+2,253+b+3);






///////////////////lights




ellipse(199,250,144,345,18,8);




line(185,245,206,230);




//setcolor(4);




ellipse(223,234,340,110,8,5);




line(230,237,217,252);




line(206,230,220,229);




//setfillstyle(1,4);






//floodfill(200,240,12);






/////////////////////////////////////




line(90,223,152,236);




line(152,236,137,254);




line(90,223,90,242);






//setfillstyle(10,9);




//floodfill(91,230,14);




ellipse(240,270,104,136,100,60);




ellipse(185,237,120,160,100,60);




ellipse(80,221,357,134,10,10);






line(152,236,168,228);




///////////////////////////////////////////////




line(435,116,440,171);




//////////////////////////////////////////hp




//line(134,185,220,210);




line(134,185,196,160);




line(214,212,318,185);




/////////////////////////////////////////////////light






//setcolor(14);




ellipse(166,247,99,330,8,8);




ellipse(171,243,310,129,7,7);




putpixel(174,250,13);




putpixel(173,251,13);




putpixel(164,239,13);




putpixel(165,238,13);






/////////////////////////////////////////road/////////////////////




setcolor(13);




line(1,430,639,300);




line(1,445,639,315);






line(1,210,93,194);




line(1,195,194,158);






//line(1,170,639,71);




//line(1,170,229,135);




line(520,90,639,71);




line(478,86,639,56);






   int c=0;






   line(10,194+c,10,208+c);




line(40,189+c,40,204+c);




line(70,183+c,70,198+c);




line(100,176+c,100,190+c);