Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
| Download

📚 The CoCalc Library - books, templates and other resources

Views: 96113
License: OTHER
1
/* Example code for Think OS.
2
3
Copyright 2014 Allen Downey
4
License: GNU GPLv3
5
6
*/
7
8
#include <stdio.h>
9
int main()
10
{
11
int val = 0;
12
char card_name[] = "Q";
13
14
switch (card_name[0]) {
15
case 'K':
16
case 'Q':
17
case 'J':
18
val = 10;
19
break;
20
case 'A':
21
val = 11;
22
break;
23
default:
24
val = atoi(card_name);
25
}
26
27
printf("%d\n", val);
28
}
29
30