<mosaic.cnfolio.com>
PROGRAM
  1. /*start:
  2. 2 player game
  3. players may have 2-10 cards
  4. numbers on cards can be different
  5. numbers on cards 1-10
  6. cards must be arranged from highest to lowest
  7. player 1 show card
  8. player 2 show card
  9. if player 1 has a higher card in a turn display  ( player one wins )
  10. else
  11. if draw then show next highest card
  12. else
  13. if one player is out of cards then the other player wins
  14. else
  15. if both players run out of cards then draw
  16. end*/
  17.  
  18. #include<stdio.h>
  19.  
  20. int main(void){
  21.    int player1, player2;
  22.    int array[50], n, i, j, temp;
  23.    printf("player 1 wins\n");
  24.    if("%d cards/n is >7");
  25.    scanf("%d", &n);
  26.    printf("player 1 has %d cards\n", n);
  27.    for(i = 0; i < n; i++)
  28.         scanf("%d", &array[i]);
  29.       for (i = 0 ; i < ( n - 1 ); i++){
  30.         for (j= 0 ; j < n - i - 1; j++){
  31.                if(array[j] < array[j+1]){
  32.            temp=array[j];
  33.            array[j]   = array[j+1];
  34.            array[j+1] = temp;
  35.                }
  36.         }
  37.    }
  38.    printf("Sorted list in descending order:\n");
  39.    for ( i = 0 ; i < n ; i++ )
  40.        printf("%d\n", array[i]);
  41.       return 0;
  42.  
  43. }