Professional Documents
Culture Documents
Cows and Bulls
Cows and Bulls
COWS AND
BULLS
-Anurag Mishra
-Ch.V.Sai Praveen
-Shubham Sahai
-Utkarsh Yadav
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
void main()
{clrscr();
char
copy[20],player1[20],player2[20],p2[10],p1[10],qui
t[3],enter[10];
int select,i,check,bull,rp=0,cow,win,j=0,k;
cout<<"Welcome to cow's and bull's . Press Enter
to continue ";
gets(enter);
clrscr();
do
{cout<<"Player 1 enter your name = ";
gets(player1);
clrscr();
cout<<"Player 2 Enter your name = ";
gets(player2);
clrscr();
char rules[5];
int f=0;
while(f==0)
{cout<<"Would you like to read the rules of the
games = ";
gets(rules);
if(strcmp(rules,"yes")==0 ||
strcmp(rules,"no")==0)
{f=1;
if (strcmp(rules,"yes")==0)
cout<<"1. One of the player would enter a
number.\n2. Player two would have to guess the
number .\n3.If player two guesses the number
correct he wins the game or else he would \nfind
no. of bulls and cows which would give him
information about the number of digits in correct
places and wrong places respectively\n";
cout<<"
getch();
}
";