-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_of_main.c
49 lines (49 loc) · 1.31 KB
/
example_of_main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <stdio.h>
#include <stdbool.h>
#define MAX 100
#include "hands_in_bridge.h"
int main()
{
int n=0,i,temp;
struct hand A[MAX];
char k,c;
do
{
scanf(" %c",&k);
switch (k)
{
case 'i': n = readFromInput(A);
break;
case 's': scanf ("%d",&i);
if (i>=0 && i<n)
printHand(A[i]);
printf ("\n");
break;
case 'r': scanf ("%d",&i);
if (i>=0 && i<n)
response(A[i]);
printf ("\n");
break;
case 'p': scanf ("%d",&i);
if (i>=0 && i<n)
{
temp = hcp(A[i]);
printf ("%d HCP (%d total)\n",temp,temp+declarer(A[i]));
}
printf ("\n");
break;
case 'd': scanf ("%d",&i);
if (i>=0 && i<n)
{
if (balanced(A[i]))
printf ("Balanced distribution\n");
else
printf ("Unbalanced distribution\n");
}
printf ("\n");
break;
}
}
while (k!='q');
return 0;
}