First of all thanks memcpy & Deadplanet, even if the issue is not resolved yet.
I have done as you suggested.
-I used scanf for accepting variables.
-getch() allows you to compile the program and view the output screen. Otherwise you'll need to press control+F9
& then alt+F5.
Also, I'm using Turbo c if that will help.
Code:
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
int cows,bulls,i;
char a,b,c,d,A,B,C,D;
clrscr();
printf("Welcome to Mastermind \n\n Player 1,enter the letters of you word.");
scanf("%c%c%c%c",&a,&b,&c,&d);
printf("Player2, please get ready");
for(i=1;i<=10;i++)
{
bulls=0;cows=0;
printf("\nGuess %d\n",i);
scanf("%c%c%c%c",&A,&B,&C,&D);
if(a==A)bulls++;
if((a==B)||(a==C)||(a==D))cows++;
if(b==B)bulls++;
if((b==A)||(b==C)||(b==D))cows++;
if(c==C)bulls++;
if((c==A)||(c==B)||(c==D))cows++;
if(d==D)bulls++;
if((d==A)||(d==B)||(d==C))cows++;
if(bulls==4) printf("Congratulations player 2, you have cracked the Mastermind");
else printf("Bulls = %d Cows = %d",bulls,cows);
}
getch();
}