a time pass between two players

a time pass between two players - #include...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 #include<stdlib.h> #include<stdio.h> #include<conio.h> #include<string.h> #include<ctype.h> void Screen() void Rule() void Shuffle() void Player1() void Player2() void check() char player1_name[50]={'/0'} char player2_name[50]={'/0'} char player1_card[500]={'/0'} char player2_card[500]={'/0'} char choice1 char choice2 int player1_card_no[500] int player2_card_no[500] int no_assigned[500] int last_turn_won=0,l1,l2,p_one=0,index1,index2,win=0 int p_two=0,value_of_card1,value_of_card2,last_turn void main() { int i char ch clrscr() Rule() do { clrscr() Shuffle() clrscr() l1=strlen(player1_name) l2=strlen(player2_name) Player1() Player2() if(value_of_card2>value_of_card1) { last_turn_won=2 p_two=p_two+1 player2_card[p_two]=choice1 player2_card_no[p_two]=value_of_card1 player1_card[index1]='*' player1_card_no[index1]=-1 Screen()
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Sheet1 Page 2 printf(" %s WINS THE BET!! Press any key. ....... ",player2_name) getch() choice1='/0' choice2='/0' } else { last_turn_won=1 p_one=p_one+1 player1_card[p_one]=choice2 player1_card_no[p_one]=value_of_card2 player2_card[index2]='*' player2_card_no[index2]=-1 Screen() printf(" %s WINS THE BET!! Press any key. ....",player1_name) getch() choice1='/0' choice2='/0' } for( ) { win=0 check() if(win==1) break switch(last_turn_won) { case 1: Player1() last_turn=1 break case 2: Player2() last_turn=2 break } if(last_turn==1) Player2() else Player1() if(value_of_card2>value_of_card1) { last_turn_won=2 p_two=p_two+1
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/06/2010 for the course UBIT 411 taught by Professor Saleemelahi during the Spring '10 term at University of Karachi.

Page1 / 9

a time pass between two players - #include...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online