#include <stdio.h>
#include <string.h>
main()
{
int a,b,c;
int count = 1;
for (b = c = 10;
a = "- FIGURE?, MONU,JAI Hind Ahwan,\
TFy!QJu ROo TNn(ROo)SLq SLq ULo+\
UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^\
NBELPeHBFHT}TnALVlBLOFAkHFOuFETp\
HCStHAUFAgcEAelclcn^r^r\\tZvYxXy\
T|S~Pn SPm SOn TNn ULo0ULo#ULo-W\
Hq!WFs XDt!"[b+++21]; )
for(; a-- > 64; )
putchar ( ++c=='Z' ? c = c/ 9:33^b&1);
return 0;
}
Jothi Gallary ( Games Using ComputerApplications )
Hello Everybody!!! Welcome To JOTHIGALLARY I H've Presented u some informations additionaly regarding general things such as., Programming Languages C,C++,Java,CG Gaming, Mathematical Puzzles,etc Viewers can contact me for any queries at., jothi388@gmail.com
Thursday, August 15, 2013
Monday, August 5, 2013
Bubble Sort C Language
#include/*stdio.h*/
void swap(int *a,int *b);
main()
{
int ar[5],i,j,n;
ar[0]=7;ar[1]=3;ar[2]=9;ar[3]=2;ar[4]=11;
printf("Array before sort:\n\n");
for(i=0;i<5;i++)
printf("ar[%d]=%d\n",i,ar[i]);
n=5; /*numberof items in sort array*/
for(i=0;i for(j=0;j {
if(ar[j]>ar[j+1])
swap(&ar[j],&ar[j+1]);
}
printf("Array after sort:\n\n");
for(i=0;i<5;i++)
printf("ar[%d]=%d\n",i,ar[i]);
system("pause");
return 0;
}
void swap(int *a,int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
}
void swap(int *a,int *b);
main()
{
int ar[5],i,j,n;
ar[0]=7;ar[1]=3;ar[2]=9;ar[3]=2;ar[4]=11;
printf("Array before sort:\n\n");
for(i=0;i<5;i++)
printf("ar[%d]=%d\n",i,ar[i]);
n=5; /*numberof items in sort array*/
for(i=0;i
if(ar[j]>ar[j+1])
swap(&ar[j],&ar[j+1]);
}
printf("Array after sort:\n\n");
for(i=0;i<5;i++)
printf("ar[%d]=%d\n",i,ar[i]);
system("pause");
return 0;
}
void swap(int *a,int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
}
Saturday, December 15, 2012
Jothi's SNAKE game using C++
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
char a[25][25];
int q1=24,q2=4,t1,t2,c1=0;
int li=3,sc=0;
char c;
typedef struct snake *position;
struct snake
{
int r,c;
int *add;
position next;
};
position first,last,temp,t;
void move();
void eat();
void definition();
void movement(char c);
void memory();
void memory()
{
first=position(malloc(sizeof(struct snake)));
first->r=q1;
first->c=q2;
first->next=NULL;
}
void definition()
{
memory();
temp=first;
last=first;
for(int i=0;i<25;i++)
for(int j=0;j<25;j++)
{if((i<23&&i>1)&&(j<23&&j>1))//&&(i%2!=0)&&(j%2!=0))
{
a[i][j]='.';
c1++;
}
else
a[i][j]=32;
}
a[q1][q2]='#';
for(i=5;i<20;i++)
for(j=5;j<20;j++)
if((i%2==0)&&(j%2==0))
a[i][j]='*';
}
void move()
{
memory();
temp->next=first;
temp=first;
t=last->next;
a[last->r][last->c]=32;
free(last);
last=t;
}
void eat()
{
memory();
temp->next=first;
temp=first;
}
void main()
{
clrscr();
definition();
while(1)
{
clrscr();
cout<<"\n\t\tSnake Game\n\tLife="<<li<<"\tScore"<<sc<<"\n\n\t";
for(int m=0;m<30;m++)
cout<<"=";
cout<<"\n";
for(int i=0;i<25;i++)
{cout<<"\t||";
for(int j=0;j<25;j++)
cout<<a[i][j];
cout<<"||\n";
}
cout<<"\t";
for(m=0;m<30;m++)
cout<<"=";
if(sc>=c1||li<=0)
{
if(sc>=c1)
cout<<"\n\n\nCongradge, U won....\nReally it's a amazing performance";
if(li<=0)
cout<<"\n\n\nSorry, U lost...\nBetter luck next time";
getch();
exit(0);
}
c=getch();
movement(c);
}
}
void movement(char c)
{
if((c=='4')||(c=='8')||(c=='6')||(c=='2'))
{
if(c=='4')
{
if(((a[q1][q2-1]==32)||(a[q1][q2-1]=='.'))&&(q2-1>=0))
{
if(a[q1][q2-1]=='.')
{ sc++;
eat();
}
else move();
a[q1][--q2]='#';
}
else
li--;
}
if(c=='6')
{
if(((a[q1][q2+1]==32)||(a[q1][q2+1]=='.'))&&(q2+1<=24))
{
if(a[q1][q2+1]=='.')
{
sc++;
eat();
}
else move();
a[q1][++q2]='#';
}
else
li--;
}
if(c=='8')
{
if(((a[q1-1][q2]==32)||(a[q1-1][q2]=='.'))&&(q1-1>=0))
{
if(a[q1-1][q2]=='.')
{
sc++;
eat();
}
else move();
a[--q1][q2]='#';
}
else
li--;
}
if(c=='2')
{
if(((a[q1+1][q2]==32)||(a[q1+1][q2]=='.'))&&(q1+1<=24))
{
if(a[q1+1][q2]=='.')
{
sc++;
eat();
}
else move();
a[++q1][q2]='#';
}
else
li--;
}
}
}
for any Queries Contact me by.,
jothi388@gmail.com
Guidelines::::
Try this under any OS but in TurboC++ or Borland C++ only in order to get Correct O/P...
All The Best...
and we'll(VINOTH,NIJISH,DINESH,KAVITHA) see u back soon....
Subscribe to:
Posts (Atom)