Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <stdbool.h>
- int checkcard(char a[3])
- {
- char sub[] = a;
- switch(sub)
- {
- case('q'):
- case('j'):
- case('k'):
- {
- return 10;
- break;
- }
- case('a'):
- {
- return 11;
- }
- default:
- return atoi(a);
- }
- }
- int main()
- {
- int score;
- for(int a = 1; a = 1;)
- {
- char cardname[3];
- puts("Введите карту\n");
- scanf("%s", cardname);
- if(cardname == 'x')
- break;
- if(cardname == 'n')
- {
- score = 0;
- puts("Ок. Давай сначала \n");
- break;
- }
- int val = checkcard(cardname);
- if (val >= 10);
- score++;
- scanf("Ваше очко: %i \n", score);
- if(val > 0 && val < 9)
- score--;
- scanf("Ваше очко: %i \n", score);
- else puts("Значеник инвалидно! \n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment