The Mind Reader Game


/*NOTE THAT THE GAME WORKS ONLY IN TURBO C ENVIRONMENT IF YOU WANT TO RUN THE PROGRAM IN ANY OTHER ENVIRONMENT THEN THEN YOU HAVE TO DOWNLOAD THE WINBGI SOFTWARE AND ALSO FOLLOW THE INSTRUUCTION ONLINE */
#include<conio.h>
#include<stdio.h>
#include<dos.h>
#include<stdlib.h>
void First_Card(void);
void Second_Card(void);
void Third_Card(void);
void Fourth_Card(void);
void Fifth_Card(void);
void Sixth_Card(void);
void Analyze(void);
int Check(void);
int main()
{
      clrscr();
      int ans=0,in=0;
   _setcursortype(_NOCURSOR);
   First_Card();
     in=Check(); if (in==0) ans+=1;
   Second_Card();
     in=Check(); if (in==0) ans+=2;
   Third_Card();
     in=Check(); if (in==0) ans+=4;
   Fourth_Card();
     in=Check(); if (in==0) ans+=8;
   Fifth_Card();
     in=Check(); if (in==0) ans+=16;
   Sixth_Card();
     in=Check(); if (in==0) ans+=32;
     textcolor(WHITE);textbackground(BLACK);
     clrscr(); Analyze();     clrscr();
   if(ans>60) {gotoxy(20,12);printf(“You Entered Incorrect Information.”);}
   else
   {
       gotoxy(28,13);printf(“Your No Is : \”%d\””,ans);}
   gotoxy(20,14);printf(“Thanks For Using This Program… “);
   gotoxy(30,22);printf(“Made By : “);
   gotoxy(37,23);printf(“ANIMESH SHAW”);getch();return 0;
}
void First_Card(void)
{
gotoxy(25,6);  printf(“ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»”);
gotoxy(25,7);  printf(“º  C O M P U T E R   G A M E  º”);
gotoxy(25,8);  printf(“ÌÍÍÍÍËÍÍÍÍËÍÍÍÍËÍÍÍÍËÍÍÍÍËÍÍÍ͹”);
gotoxy(25,9);  printf(“º 1  º 3  º 5  º 7  º 9  º 11 º”);
gotoxy(25,10); printf(“ÌÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍ͹”);
gotoxy(25,11); printf(“º 13 º 15 º 17 º 19 º 21 º 23 º”);
gotoxy(25,12); printf(“ÌÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍ͹”);
gotoxy(25,13); printf(“º 25 º 27 º 29 º 31 º 33 º 35 º”);
gotoxy(25,14); printf(“ÌÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍ͹”);
gotoxy(25,15); printf(“º 37 º 39 º 41 º 43 º 45 º 47 º”);
gotoxy(25,16); printf(“ÌÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍ͹”);
gotoxy(25,17); printf(“º 49 º 51 º 53 º 55 º 57 º 59 º”);
gotoxy(25,18); printf(“ÈÍÍÍÍÊÍÍÍÍÊÍÍÍÍÊÍÍÍÍÊÍÍÍÍÊÍÍÍͼ”);
}
void Second_Card(void)
{
gotoxy(25,6);  printf(“ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»”);
gotoxy(25,7);  printf(“º  C O M P U T E R   G A M E  º”);
gotoxy(25,8);  printf(“ÌÍÍÍÍËÍÍÍÍËÍÍÍÍËÍÍÍÍËÍÍÍÍËÍÍÍ͹”);
gotoxy(25,9);  printf(“º 2  º 3  º 6  º 7  º 10 º 11 º”);
gotoxy(25,10); printf(“ÌÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍ͹”);
gotoxy(25,11); printf(“º 14 º 15 º 18 º 19 º 22 º 23 º”);
gotoxy(25,12); printf(“ÌÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍ͹”);
gotoxy(25,13); printf(“º 25 º 27 º 30 º 31 º 34 º 35 º”);
gotoxy(25,14); printf(“ÌÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍ͹”);
gotoxy(25,15); printf(“º 38 º 39 º 42 º 43 º 46 º 47 º”);
gotoxy(25,16); printf(“ÌÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍ͹”);
gotoxy(25,17); printf(“º 50 º 51 º 54 º 55 º 58 º 59 º”);
gotoxy(25,18); printf(“ÈÍÍÍÍÊÍÍÍÍÊÍÍÍÍÊÍÍÍÍÊÍÍÍÍÊÍÍÍͼ”);
}
void Third_Card(void)
{
gotoxy(25,6);  printf(“ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»”);
gotoxy(25,7);  printf(“º  C O M P U T E R   G A M E  º”);
gotoxy(25,8);  printf(“ÌÍÍÍÍËÍÍÍÍËÍÍÍÍËÍÍÍÍËÍÍÍÍËÍÍÍ͹”);
gotoxy(25,9);  printf(“º 4  º 5  º 6  º 7  º 12 º 13 º”);
gotoxy(25,10); printf(“ÌÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍ͹”);
gotoxy(25,11); printf(“º 14 º 15 º 20 º 21 º 22 º 23 º”);
gotoxy(25,12); printf(“ÌÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍ͹”);
gotoxy(25,13); printf(“º 28 º 29 º 30 º 31 º 36 º 37 º”);
gotoxy(25,14); printf(“ÌÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍ͹”);
gotoxy(25,15); printf(“º 38 º 39 º 44 º 45 º 46 º 47 º”);
gotoxy(25,16); printf(“ÌÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍ͹”);
gotoxy(25,17); printf(“º 52 º 53 º 54 º 55 º 60 º 60 º”);
gotoxy(25,18); printf(“ÈÍÍÍÍÊÍÍÍÍÊÍÍÍÍÊÍÍÍÍÊÍÍÍÍÊÍÍÍͼ”);
}
void Fourth_Card(void)
{
gotoxy(25,6);  printf(“ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»”);
gotoxy(25,7);  printf(“º  C O M P U T E R   G A M E  º”);
gotoxy(25,8);  printf(“ÌÍÍÍÍËÍÍÍÍËÍÍÍÍËÍÍÍÍËÍÍÍÍËÍÍÍ͹”);
gotoxy(25,9);  printf(“º 8  º 9  º 10 º 11 º 12 º 13 º”);
gotoxy(25,10); printf(“ÌÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍ͹”);
gotoxy(25,11); printf(“º 14 º 15 º 24 º 25 º 26 º 27 º”);
gotoxy(25,12); printf(“ÌÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍ͹”);
gotoxy(25,13); printf(“º 28 º 29 º 30 º 31 º 40 º 41 º”);
gotoxy(25,14); printf(“ÌÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍ͹”);
gotoxy(25,15); printf(“º 42 º 43 º 44 º 45 º 46 º 47 º”);
gotoxy(25,16); printf(“ÌÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍ͹”);
gotoxy(25,17); printf(“º 56 º 57 º 58 º 59 º 60 º 60 º”);
gotoxy(25,18); printf(“ÈÍÍÍÍÊÍÍÍÍÊÍÍÍÍÊÍÍÍÍÊÍÍÍÍÊÍÍÍͼ”);
}
void Fifth_Card(void)
{
gotoxy(25,6);  printf(“ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»”);
gotoxy(25,7);  printf(“º  C O M P U T E R   G A M E  º”);
gotoxy(25,8);  printf(“ÌÍÍÍÍËÍÍÍÍËÍÍÍÍËÍÍÍÍËÍÍÍÍËÍÍÍ͹”);
gotoxy(25,9);  printf(“º 16 º 17 º 18 º 19 º 20 º 21 º”);
gotoxy(25,10); printf(“ÌÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍ͹”);
gotoxy(25,11); printf(“º 22 º 23 º 24 º 25 º 26 º 27 º”);
gotoxy(25,12); printf(“ÌÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍ͹”);
gotoxy(25,13); printf(“º 28 º 29 º 30 º 31 º 48 º 49 º”);
gotoxy(25,14); printf(“ÌÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍ͹”);
gotoxy(25,15); printf(“º 50 º 51 º 52 º 53 º 54 º 55 º”);
gotoxy(25,16); printf(“ÌÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍ͹”);
gotoxy(25,17); printf(“º 56 º 57 º 58 º 59 º 60 º 60 º”);
gotoxy(25,18); printf(“ÈÍÍÍÍÊÍÍÍÍÊÍÍÍÍÊÍÍÍÍÊÍÍÍÍÊÍÍÍͼ”);
}
void Sixth_Card(void)
{
gotoxy(25,6);  printf(“ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»52 º 53 º 54 º 55 º”);
gotoxy(25,16); printf(“ÌÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍ͹”);
gotoxy(25,17); printf(“º 56 º 57 º 58 º 59 º 60 º 60 º”);
gotoxy(25,18); printf(“ÈÍÍÍÍÊÍÍÍÍÊÍÍÍÍÊÍÍÍÍÊÍÍÍÍÊÍÍÍͼ”);
}
 int Check(void)
{
  int loop,key,index=0;
  char *menu[]={” Yes “,” No “};
  textcolor(WHITE);
  textbackground(CYAN);
  while(1)
  { for (loop=0;loop<2;loop++)
    { if (loop==index)
textbackground(YELLOW);
      else
textbackground(CYAN);
      gotoxy(33+loop*10,20);cprintf(“%s”,menu[loop]);
    }
    key=getch();
    switch(key)
    { case 75:
index–;if (index<0) index=1;break;
      case 77:
index++;if (index>1) index=0;break;
      case 13: return index;
    }
  }
}
void Analyze(void)
{
 gotoxy(30,10); printf(“Analyzing Result…”);
 gotoxy(25,11); printf(“ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»”);
 gotoxy(25,12); printf(“º °°°°°°°°°°°°°°°°°°°°°°°°°°° º”);
 gotoxy(25,13); printf(“ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ”);
 for(int a=27;a<=53;a++)
 { delay(100);
   gotoxy(a,12);printf(“%c”,219);
 }
}

NUMBER MAGIC GAME


#include<stdio.h>
#include<conio.h>
int generate(void);
int fun(int);
main()
{
 int i,a,r;

 printf(“\n\nANIMESH Welcomes You!\n IN THE JARGON OF A NUMBER..”);
 printf(“\nPress any key to continue….”);
 getch();
 printf(“\n\nJust think a number between 1 to 63 in your mind”);
 printf(“\nThink on one”);
 printf(“\nDo not enter that number”);
 printf(“\n\nI will find that number on your mind….”);
 printf(“\n\nPress any key to continue…”);
 getch();
 printf(“\nBy Just answering few questions….”);
 printf(“\n\nIf your number is present in the numbers”);
 printf(“\n\nshown on your screen,Then press P and if not present”);
 printf(“\n\n then press N”);
 printf(“But please be honest while entering the answer…”);
 printf(“\n\nPress any key to continue…”);
 getch();
 r=generate();
 if(r==0)
 {
  printf(“\nYou didn’t think of any number between 1 to 63”);
  printf(“\nSo try again…”);
 }
 else
 {
 printf(“\nYour number is %d”,r);
 printf(“\nSurprised! But friends it is not a magic,”);
 printf(“\nit just involves some mathematical computation….”);
 printf(“\nso guys just try to find out the method.”);
 printf(“\nThank You!”);
 printf(“\nProgrammed By:\n\t\tAnimesh shaw”);
 }
 getch();
}
int generate()
{
 int a,i,j,f,num[6],n,r=0;
 char ch[6];
 for(j=0;j<=5;j++)
 {
  f=fun(j);
  for(i=1;i<=63;i++)
  {
   f=fun(j);
   printf(” %d”,f);
   a=i & f;
   if(a==f)
   printf(” %d”,i);
  }
  printf(“\n\n  Let me remind you if the number is present then”);
  printf(“\n press P otherwise press N”);
  printf(“\nEnter your answer: “);
  ch[j]=getche();
  printf(“\nPress any key to continue….”);
  if(ch[j]==’p’ || ch[j]==’P’)
  {
   num[j]=1;
   n=fun(j);
   r=r+n;
  }
  else
  num[j]=0;
  getch();
 }
 for(j=5;j>=0;j–)
 {
 printf(” %d”,num[j]);
 if(ch[j]==’p’ || ch[j]==’P’)
 num[j]=1;
 else
 num[j]=0;
 }
 printf(” %d”,r);
 return r;
}
int fun(int j)
{
 if(j==0)
 return 1;
 else
 return (2*fun(j-1));
}

HIGH LOW GAME


     /* HIGH/LOW GAME */
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
/*
This program plays a simple game.The computer picks a random number
from
0 to 100, and the user tries to guess the number.
*/
const int totchan=7;
main()
{
 int number;        //the computer’s random number
 int guess;         //the user’s guess
 int chances=0,score=0,chanscor;        //chanscor stores score for 1 successful chance.
 char ans;
 do
 {
   chances=score=0;
   cout<<“\nWelcome to the High/Low game.”;
   cout<<“\nI will pick a random number from 0 to 100.”;
   cout<<“\nYou must try to guess the number.”;
 
   number=(int)(rand()%100);
   chanscor=100/totchan;        //score for each successful chance
   do
   {
     cout<<“\nWhat is your guess? (0 to 100) “;
     cin>>guess;
     if((guess<0)||(guess>100))
     {
cout<<“Sorry, but your guess “<<guess<<“must be from 0 to 100.”;
     }
     else if(guess < number)
     {
cout<<guess<<” is low.Try a higher number.”;
     }
     else if(guess > number)
     {
cout<<guess<<” is high.Try a lower number.”;
     }
     else //if correct number is guessed
     { //number is correct, and the “do” loop will end below
cout<<guess<<” is correct. Congratulations!”;
score=chanscor*(totchan-chances);   //score calculated for number of chances left
cout<<“Your score is “<<score<<endl;
        break;
     }
     chances++;
     if(guess!=number)
cout<<“Now you have “<<totchan-chances<<“chances left.”<<endl;
     if(chances==totchan)
{ cout<<“Only “<<totchan<<“chances are allowed.Better luck next time”;
  cout<<“\nThe actual number was “<<number<<endl;
  break;
}
     }while (guess!=number);
     cout<<“Thank you for playing High/Low!”;
     cout<<“Want to play it again? (y/n)…”;
     cin>>ans;
   }while(ans==’y’ || ans==’Y’);
 }

FLAMES GAME


/*Program to play the game of comparing to Names and checking out
FLAMES…..Enjoy……*/
//————————ANIMESH SHAW——————————//

#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<malloc.h>

typedef struct flames
{
char c;
struct flames *next;
}flames;

char* relation(char ch);

main()
{
char s1[20],s2[20],s3[20],s4[20],f[]={“FLAMES”},ch;
int i=0,j=0,k=0,l1,l2,count=0,m=0;
flames *head,*ne2,*ne3,*ne4,*ne5,*ne6,*temp,*p;
char *relate;

printf(“\n\nEnter First Name:: “);
gets(s1);
printf(“\nEnter Second Name:: “);
gets(s2);

strcpy(s3,s1);
strcpy(s4,s2);

for(i=0;i<(l1=strlen(s1));i++)
{
for(j=0;j<(l2=strlen(s2));j++)
{
if(s1[i]==s2[j])
{
s2[j]=-1;
s3[i]=-1;
}

}
}
for(i=0;i<strlen(s3);i++)
{
if(s3[i]!=-1)
count++;
}
for(j=0;j<strlen(s2);j++)
{
if(s2[j]!=-1)
count++;
}
printf(“\n\n”);
puts(s3);
puts(s2);
printf(“\n\nLetters left are %d”,count);
printf(“\nchecking for F L A M E S…………..\n\n”);
/*Creating CLL for flames*/
head=(struct flames*)malloc(sizeof(struct flames));
ne2=(struct flames*)malloc(sizeof(struct flames));
ne3=(struct flames*)malloc(sizeof(struct flames));
ne4=(struct flames*)malloc(sizeof(struct flames));
ne5=(struct flames*)malloc(sizeof(struct flames));
ne6=(struct flames*)malloc(sizeof(struct flames));
head->c=’f’; head->next=ne2;
ne2->c=’l’; ne2->next=ne3;
ne3->c=’a’; ne3->next=ne4;
ne4->c=’m’; ne4->next=ne5;
ne5->c=’e’; ne5->next=ne6;
ne6->c=’s’; ne6->next=head;
/////displaying CLL
temp=head;
i=0;
while(i<6)
{
printf(” %c”,temp->c-32);
temp=temp->next;
i++;
}
printf(“\n”);
temp=head;
while(m<5)
{
for(i=0;i<count-2;i++)
temp=temp->next;
printf(“\nDeleting %c”,temp->next->c);
p=temp->next;
temp->next=temp->next->next;
temp=temp->next;
free(p);
m++;
}
ch=temp->c;
printf(“\n\tSo…..The Relation is :::::: “);
relate=relation(ch);
puts(relate);
printf(“\n\n”);
getch();
}
char* relation(char ch)
{
char *rel;
switch(ch)
{
case ‘f’:
return rel=”FRIENDSHIP”;
case ‘l’:
return rel=”LOVE”;
case ‘a’:
return rel=”ATTRACTION”;
case ‘m’:
return rel=”MARRIAGE”;
      case ‘e’:
return rel=”ENEMY”;
case ‘s’:
return rel=”SISTER”;
}
}

G.K. QUIZ GAME IN C


#include<iostream.h>
#include<conio.h>

main()
{

int x,y,z;
x=y=z=0;
char ch1[100],ch2,ch3,ch4,ch5,ch6,ch7,ch8,ch9,ch10,ch11;
cout<<“ Guest Enter Your Name”;
cin>>ch1;

cout<<“ Welcome “<<ch1<<“. Sobriquet is an unofficial title or name given to someone or something.”;
cout<<” Enter answer in form of ‘a’,’b’ and’c’only.”;
cout<<“ What is called as ‘ THE HOLY LAND’?\na.Jerusalem\nb.Mathura\nc.Meccan\n”;
cin>>ch2;
if(ch2==’a’)
{
x=x+10;
cout<<“\nGood Job.Your score is “<<x;

}
else
cout<<“\nSorry wrong answer.”;
getch();

cout<<“ What is called as ‘ THE ROOF OF THE WORLD’?\na.Nepal\nb.Rome\nc.Tibet”;
cin>>ch2;
if(ch2==’c’)
{
x=x+10;
cout<<“Good Job.Your score is “<<x;

}
else
cout<<“Sorry wrong answer.”;
getch();
cout<<“ What is called as ‘ THE LAND OF RISING
SUN’?
a.Chicago
b.Japan
c.Tibet
“;
cin>>ch2;
if(ch2==’b’)
{
x=x+10;
cout<<“Good Job.
Your score is “<<x;

}
else
cout<<“Sorry wrong answer.”;
getch();

cout<<“

What is called as ‘ THE GIFT OF
NILE’?
a.Chicago
b.Egypt
c.Africa
“;
cin>>ch2;
if(ch2==’b’)
{
x=x+10;
cout<<“
Your score is “<<x;

}
else
cout<<“Sorry wrong answer.”;
getch();

cout<<“

What is called as ‘ THE LAND OF MIDNIGHT
SUN’?
a.Norway
b.Japan
c.Australia
“;
cin>>ch2;
if(ch2==’a’)
{
x=x+10;
cout<<“
Your score is “<<x;

}
else
cout<<“Sorry wrong answer.”;
getch();

cout<<“

What is called as ‘ THE LAND OF
THUNDERBOLT’?
a.Bhutan
b.Canada
c.Arab
“;
cin>>ch2;
if(ch2==’a’)
{
x=x+10;
cout<<“
Your score is “<<x;

}
else
cout<<“Sorry wrong answer.”;
getch();

cout<<“

What is called as ‘ THE WINDY
CITY?
a.Jerusalem
b.Japan
c.Chicago
“;
cin>>ch2;
if(ch2==’c’)
{
x=x+10;
cout<<“
Your score is “<<x;

}
else
cout<<“Sorry wrong answer.”;
getch();

cout<<“

What is called as ‘ THE LAND OF WHITE
ELEPHANTS’?
a.Bangladesh
b.Thailand
c.India
“;
cin>>ch2;
if(ch2==’b’)
{
x=x+10;
cout<<“
Your score is “<<x;

}
else
cout<<“Sorry wrong answer.”;
getch();
cout<<“

What is called as ‘ THE CITY OF SEVEN
HILLS’?
a.Rome
b.Nilgiri Hills
c.Tibet
“;
cin>>ch2;
if(ch2==’a’)
{
x=x+10;
cout<<“
Your score is “<<x;

}
else
cout<<“Sorry wrong answer.”;
getch();

cout<<“

What is called as ‘ THE DARK
CONTIENENT’?
a.Asia
b.Australia
c.Africa
“;
cin>>ch2;
if(ch2==’c’)
{
x=x+10;
cout<<“
Your score is “<<x;

}
else
cout<<“Sorry wrong answer.”;
getch();

if(x==100)
cout<<“No cheating…… You have done this earlier also.”;
if(x==90)
cout<<“You are extremely intelligent
 Your Score is 90″;
if(x==80)
cout<<“You are intelligent
 Your Score is 80″;
if(50==x||x==70||x==60)
cout<<“You are average
 Your Score is “<<x<<“
Better luck next
time”;
else if(x<=40)
cout<<“No use…….. Not even 5 questions right”;
getch();
}

cricket team formation project


#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<fstream.h>
#include<string.h>
#include<iomanip.h>
#include<stdlib.h>
class batsman
{
     public:
       char name[20];
       float avg,sr;
       friend team;
};
class bowler
{
    public:
      char name[20],style[5];
      float avg;
      friend team;
};
class team
{
    public:
      char tname[20];
      batsman bat[11];
      bowler bowl[11];
      void load(char *);
      void teame();
      void pedit();
      void save(char*,char*);
};
void team::load(char *fn)
{
   ifstream fin(fn);
   fin>>tname;
   for(int i = 0; i < 11; i++)
    {
       fin>>bat[i].name;
       strcpy(bowl[i].name,bat[i].name);
       fin>>bat[i].avg;
       fin>>bowl[i].avg;
       fin>>bowl[i].style;
       fin>>bat[i].sr;
    }
   fin.close();
}
void team::teame()
{

   
    cout<<“Enter new values for the attribute you want to change, else enter previous values”;
    cout<<“\n\nOld Team Name : “;
    cout<<tname;
    cout<<“\nEnter the new name for team : “;
    cin>>tname;
}
void team::pedit()
{
 
   cout<<“\t\t\t\tPLAYER LIST\n”;
   cout<<“——————————————————————————-“;
   cout<<setiosflags(ios::right);
   cout<<“\n\n”<<setw(2)<<“No”<<setw(20)<<“Name”<<endl;
   for(i = 0; i < 11; i++)
   {
      cout<<“\n”<<setw(2)<<i+1<<setw(20)<<bat[i].name;
   }
   cout<<“\n\nEnter the sr.no of player you want to edit : “;
   cin>>i;
 
   cout<<“\t\t\t\tPLAYER EDITOR\n”;
   for(int j = 0; j < 80; j++)
     cout<<“-“;
   cout<<“\n\nPrevious values : “;
   cout<<“\nPlayer name : “<<bat[i-1].name;
   cout<<“\nBatting avg : “<<bat[i-1].avg;
   cout<<“\nBowling avg : “<<bowl[i-1].avg;
   cout<<“\nBowling style : “<<bowl[i-1].style;
   cout<<“\nBatting strike rate : “<<bat[i-1].sr;
   cout<<“\n\nEnter new values for the attribute you want to change, else enter previous values\n”;
   cout<<“Name : “;
   cin>>bat[i-1].name;
   strcpy(bowl[i-1].name,bat[i-1].name);
   cout<<“Batting avg : “;
   cin>>bat[i-1].avg;
   cout<<“Bowling avg : “;
   cin>>bowl[i-1].avg;
   bostyle:
   cout<<“Bowling style : “;
   cin>>bowl[i-1].style;
   if(strcmp(bowl[i-1].style,”RF”) && strcmp(bowl[i-1].style,”LF”) && strcmp(bowl[i-1].style,”RLS”) && strcmp(bowl[i-1].style,”LLS”) && strcmp(bowl[i-1].style,”ROS”) && strcmp(bowl[i-1].style,”LOS”))
      goto bostyle;
   cout<<“Batting strike rate : “;
   cin>>bat[i-1].sr;
}
void team::save(char nf[7],char of[7] = “”)
{
   ofstream fout(nf);
   fout<<tname<<endl;
   for(int i = 0; i < 11; i++)
   {
      fout<<bat[i].name<<endl;
      fout<<bat[i].avg<<endl;
      fout<<bowl[i].avg<<endl;
      fout<<bowl[i].style<<endl;
      fout<<bat[i].sr<<endl;
   }
   fout.close();
   remove(of);
}

char teams[20][20],teamc[20][7];
void agree();
void create();
void edit();
void del();
void addplay(char*);
void list();
void blist();
void view();
int main()
{
   char choice;
   agree();
   start:
 
   list();
   cout<<“\t\t\t\t\tTEAM EDITOR\n”;
   for(int i = 0; i < 80; i++)
     cout<<“=”;
   cout<<“\n\n\t\t\t\t1.Create team\n\t\t\t\t2.View Teams\n\t\t\t\t3.Edit Team\n\t\t\t\t4.Delete Team\n\t\t\t\t5.Bolwing style codes\n\t\t\t\t6.Exit\n\t\t\t\tYour choice : “;
   choice = getch();
   switch(choice)
   {
      case ‘1’:
create();
goto start;
      case ‘2’:
view();
goto start;
      case ‘3’:
edit();
goto start;
      case ‘4’:
del();
goto start;
      case ‘5’:
blist();
goto start;
      case ‘6’:
break;
      default:
goto start;
   }
   return 0;
}
void agree()
{
 
   for(int i = 0; i < 80; i++)
     cout<<“Í”;
   cout<<“\n\n       \t\t\t\tNOTE\n\n”;
 
     cout<<“ÍIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII”;
   cout<<“\n\n\n\t This program is meant for editing teams and players. \nYou will be required to input values for the same. It is recommended that you take the back up of \nthe folder in which this game is before editing any team or player because any invalid\n data can lead to incorrect working of the game. \nHowever, if you are confident that data given by you is valid, you need not take the back up. \nPlease note down the bowling style codes before creating or editing player.\n\n Enjoy the game!\n\n”;
   for(i = 0; i < 80; i++)
     cout<<“Í”;
   cout<<“(Press any key to continue)”;
   getch();
}
void list()
{
   int i = 0;
   not = 0;
   ifstream fin(“teams.log”);
   while(fin)
   {
      fin>>teamc[i];
      fin>>teams[i];
      not++;
      i++;
   }
   fin.close();
}
void create()
{
        char fn[7];
    ofstream fout;
    cout<<“\t\t\t\t\tCREATE TEAM\n”;
    for(int i = 0; i < 80; i++)
      cout<<“-“;
    cout<<“\n\nEnter the name of new team : “;
    cin>>t.tname;
    cout<<“Enter the 3 letter code(filename) for the team : “;
    again:
    cin>>fn;
    if(strlen(fn) != 3)
    {
      cout<<“Invalid code. Re-enter it : “;
      goto again;
    }
    else
    {
      strcpy(teams[not],t.tname);
      strcpy(teamc[not],fn);
      fout.open(“teams.log”);
      for(i = 0; i <= not; i++)
      {
fout<<teamc[i]<<endl<<teams[i]<<endl;
      }
      fout.close();
      strcat(fn,”.tem”);
      addplay(fn);
    }
    list();
    getch();
}
void edit()
{
 
   char fn[7],fn1[7],tn[20],tn1[20];
   char tname[20],code[7];
   ifstream fin;
   ofstream fout;
   cout<<“\t\t\t\t\tTEAM EDIT\n”;
   for(int i = 0; i < 80; i++)
     cout<<“-“;
   cout<<setiosflags(ios::left);
   cout<<“\t\t\t”<<setw(20)<<“Team Name”<<setw(5)<<“Code”<<endl<<endl<<endl;
   for(i = 0; i < not; i++)
      cout<<“\t\t\t”<<setw(20)<<teams[i]<<setw(5)<<teamc[i]<<endl;
   cout<<“\n\n\nEnter the team code(type ‘back’to go back to main menu) : “;
   repeat:
   cin>>fn;
   if(strcmp(fn,”back”))
   {
     strcpy(tn,fn);
     strcat(tn,”.tem”);
     fin.open(tn);
     if(fin.good() == 0)
     {
       cout<<“Team does not exist”;
       cout<<“\nRe-enter code : “;
       fin.close();
       goto repeat;
     }
     else
     {
       fin.close();
       cout<<“Loading, please wait…”;
       clrscr();
       t.load(tn);
       cout<<“\t\t\t\t\t”<<t.tname<<endl;
       for(i = 0; i < 80; i++)
cout<<“-“;
       cout<<“\n\n\t\t\t\t1.Edit team\n\t\t\t\t2.Edit Player”;
       switch(getch())
       {
 case ‘1’:
   t.teame();
   cout<<“\n\nOld Team Code : “;
   cout<<fn;
   cout<<“\nEnter the new code for team : “;
   rename:
   cin>>fn1;
   if(strlen(fn1) != 3)
   {
     cout<<“Invalid code. Re – enter code : “;
     goto rename;
   }
   else
   {
     strcpy(tn1,fn1);
     strcat(tn1,”.tem”);
     if(strcmp(fn,fn1))
t.save(tn1,tn);
     else
t.save(tn);
     fin.open(“teams.log”);
     fout.open(“temp.log”);
     while(fin)
     {
fin>>tn;
fin>>tn1;
if(strcmp(fn,tn))
{
  fout<<tn<<endl<<tn1<<endl;
}
else
{
  fout<<fn1<<endl<<t.tname<<endl;
}
     }
     fin.close();
     fout.close();
     remove(“teams.log”);
     rename(“temp.log”,”teams.log”);
     cout<<“Team successfully edited.”;
     list();
   }
   break;
 case ‘2’:
   t.pedit();
   t.save(tn);
   cout<<“Player edited successfully”;
   break;
       }
     }
   }
}
void del()
{
   
     char fn[7],tn[20];
     ofstream fout;
     ifstream fin;
     cout<<“\t\t\t\tDELETE TEAM\n”;
     for(int i = 0; i < 80; i++)
       cout<<“-“;
     cout<<setiosflags(ios::left);
     cout<<“\t\t\t”<<setw(20)<<“Team Name”<<setw(5)<<“Code”<<endl<<endl<<endl;
     for(i = 0; i < not; i++)
      cout<<“\t\t\t”<<setw(20)<<teams[i]<<setw(5)<<teamc[i]<<endl;
     cout<<“\n\n\nEnter the team code(type ‘back’to go back to main menu) : “;
     repeat:
     cin>>fn;
     if(strcmp(fn,”back”))
     {
strcpy(tn,fn);
strcat(tn,”.tem”);
remove(tn);
fin.open(“teams.log”);
fout.open(“temp.log”);
while(fin)
{
 fin>>tn;
 if(strcmp(tn,fn))
 {  fout<<tn<<endl;
    fin>>tn;
    fout<<tn<<endl;
 }
 else
 {
   fin>>tn;
 }
}
fin.close();
fout.close();
remove(“teams.log”);
rename(“temp.log”,”teams.log”);
     }
     list();
}
void addplay(char *fn)
{
    ofstream fout(fn);
   
    fout<<t.tname<<endl;
    cout<<“Enter the name, batting avg ,bowling avg, bowling style and batting strike rate of 11 players : \n”;
    for(int i = 0; i < 11; i++)
    {
       cout<<“\nName : “;
       cin>>t.bat[i].name;
       strcpy(t.bowl[i].name,t.bat[i].name);
       fout<<t.bat[i].name<<endl;
       cout<<“Batting avg : “;
       cin>>t.bat[i].avg;
       if(!strcmp(t.bat[i].name,”D.Bradman”))
t.bat[i].avg = 90;
       fout<<t.bat[i].avg<<endl;
       cout<<“Bowling avg : “;
       cin>>t.bowl[i].avg;
       if(!strcmp(t.bowl[i].name,”G.Mcgrath”))
 t.bowl[i].avg = 5;
       fout<<t.bowl[i].avg<<endl;
       bstyle:
       cin>>t.bowl[i].style;
       if(strcmp(t.bowl[i].style,”RF”) && strcmp(t.bowl[i].style,”LF”) && strcmp(t.bowl[i].style,”RLS”) && strcmp(t.bowl[i].style,”LLS”) && strcmp(t.bowl[i].style,”ROS”) && strcmp(t.bowl[i].style,”LOS”))
goto bstyle;
       fout<<t.bowl[i].style<<endl;
       cout<<“Batting strike rate : “;
       cin>>t.bat[i].sr;
       fout<<t.bat[i].sr<<endl;
    }
    fout.close();
    cout<<“\nTeam successfully created.”;
}
void blist()
{
   
    cout<<“\t\t\t\tBOWLING STYLES LIST\n”;
    for(int i = 0; i < 80; i++)
      cout<<“-“;
    cout<<“\n\n\n\t\t”<<setw(25)<<“STYLE”<<setw(15)<<“CODE”<<endl<<endl;
    cout<<“\t\t”<<setw(25)<<“Right arm fast”<<setw(15)<<“RF”<<endl;
    cout<<“\t\t”<<setw(25)<<“Left arm fast”<<setw(15)<<“LF”<<endl;
    cout<<“\t\t”<<setw(25)<<“Right arm leg spin”<<setw(15)<<“RLS”<<endl;
    cout<<“\t\t”<<setw(25)<<“Left arm leg spin”<<setw(15)<<“LLS”<<endl;
    cout<<“\t\t”<<setw(25)<<“Right arm off spin”<<setw(15)<<“ROS”<<endl;
    cout<<“\t\t”<<setw(25)<<“Left arm off spin”<<setw(15)<<“LOS”<<endl;
    cout<<“\n\n\n(Press any key to continue)”;
    getch();
}
void view()
{
 
   char fn[8],tn[8];
   ifstream fin;
   cout<<“\t\t\t\t\tVIEW TEAMS\n”;
   for(int i=0;i<80;i++)
     cout<<“-“;
     cout<<setiosflags(ios::left)<<setprecision(2);
   cout<<“\t\t\t”<<setw(20)<<“Team Name”<<setw(5)<<“Code”<<endl<<endl<<endl;
   for(i = 0; i < not; i++)
      cout<<“\t\t\t”<<setw(20)<<teams[i]<<setw(5)<<teamc[i]<<endl;
   cout<<“\n\n\nEnter the team code(type ‘back’to go back to main menu) : “;
   repeat10:
   cin>>fn;
   if(strcmp(fn,”back”))
   {
     strcpy(tn,fn);
     strcat(tn,”.tem”);
     fin.open(tn);
     if(fin.good() == 0)
     {
       cout<<“Team does not exist”;
       cout<<“\nRe-enter code : “;
       fin.close();
       goto repeat10;
     }
     else
     {
fin.close();

t.load(tn);
cout<<“\t\t\t\t”<<t.tname<<endl;
for(i = 0; i < 80; i++)
 cout<<“-“;
cout<<“\n\n”<<setw(20)<<“NAME”<<setw(15)<<“Bat. avg.”<<setw(15)<<“bowl.avg.”<<setw(15)<<“Bowl style”<<setw(15)<<“Bat. StrikeRate”;
cout<<endl;
for(i = 0; i < 11; i++)
 cout<<endl<<setw(20)<<t.bat[i].name<<setw(15)<<t.bat[i].avg<<setw(15)<<t.bowl[i].avg<<setw(15)<<t.bowl[i].style<<setw(15)<<t.bat[i].sr;
cout<<“\n\n\n(Press any key to continue)”;
getch();
     }
   }
}

BANKING PROJECT IN C++(TYPE 2)


#include<iostream>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
using namespace std;

int p=1;

class Bank

    {
    public:
    char name[50],address[90],type;
    double ein_betrag, aus_betrag;
   double balance;
   int costumernr, accountnr, birth, tel;
   public:
         void newcostumer();    
         void newaccount();    
         void costumerdel();    
         void accountdel();    
         void deposit();  
         void withdraw();
         void accountinfo();
         void transaction();
};

void Bank::newcostumer()


    {
                 
        cout<<“\n Enter your name : ” << endl;
        cin>>name;
        cout << ” Enter your address: ” << endl;
             cin >>address;
        cout << ” your tel nr please: ” << endl;
        cin >>tel;
        cout << ” Enter your Date of birth: ” << endl;
        cin >>birth;
        cout<<“\n Enter your type of account :\n s for SAVING account \n f for FIXED account : “;
        cin>>type;
        cout<<“\nEnter your starting balance : Rs. “;
        cin>>balance;
             if(balance<10)
       {
       cout<<” The minimum balance is Rs. 100″;
       }
   accountnr=1000+p;
   cout<<” Your account number is : “<<accountnr<<” Always remember it”;
}
void Bank::costumerdel() {
       costumernr = 0;
        birth = 0;
       tel = 0;
       address[90] = 0;
}
void Bank::accountdel() {
        accountnr = 0;
       balance = 0;
       
       };
void Bank::deposit()


   {
   
   unsigned long int x;
   cout<<“\nEnter the amount to be deposited : “;
   cin>>x;
   balance=balance+x;
   cout<<“\n Your new balance is : Rs. “<<balance;
}

void Bank::withdraw()


   {
   
   unsigned long int x;
   cout<<“\n Your balance is : “<<balance;
   if(type==’s’)


        {
       cout<<“\nenter the amount to be withdrawn : “;
       cin>>x;
       if( x<=(balance-10))


           {
           balance-=x;
           cout<<“\nNew account balance is : “<<balance;
       }

        else
           {
           cout<<“\n Not possible for you “;
       }

   }

   else
   cout<<“\n NOT possible for you “;
}

void Bank::accountinfo()

   {
   cout<<“\n Hello “<<name<<” Your account balance is : “<<balance;
}

main()
   {
   
   char ch;int n,x;
   Bank e[100];
   star:cout<<“\n Are you a new user(y/n) : \n Press x To go out of system”;
   cin>>ch;
    if(ch==’y’||ch==’Y’)
        {
       e[p].newcostumer();
       p++;
            getch();      
       goto star;
   }
  else
       {
        if(ch==’x’||ch==’X’)
            {
           goto end;
       }
         else
       cout<<“\n Enter your account no. : “;
       cin>>n;
       n-=1000;
       if(n>0)


           {
            cout<<“\n Enter your choice \n 1.New Account \n 2.Costumer delete \n 3.Account delete \n 4.deposit \n 5.Withdrawal \n 6.Check your account\n 7.exit \n 8.To go out of system:”;
               cin>>x;
           while(x!=8)
               {
               switch(x)


                   {
                   case 1:
                   e[n].newcostumer();break;
                   case 2:
                   e[n].costumerdel();break;
                   case 3:
                   e[n].accountdel();break;
                   case 4:
                   e[n].deposit();break;
                        case 5:
                   e[n].withdraw();break;
                   case 6:
                   e[n].accountinfo();break;
                   case 7:
                             exit(1);
                        case 8:    
                    goto end;
                   default:
                   cout<<“\nInvalid”;
               }

                cout<<“\n Enter your choice \n 1.New Account \n 2.Costumer delete \n 3.Account delete \n 4.deposit \n 5.Withdrawal \n 6.Transaction \n 7.Check your account\n 8.exit \n 9.To go out of system:”;
               cin>>x;
           } goto star;

       }
       else
       cout<<“\nInvalid”;
   }end:;

}