Yurttas/PL/IL/C/F-mar11/01/02/00/08/a 08.c

 1/*
 2   Copyright(C) 1998
 3   All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4
 5   Permission to use, copy, modify, and distribute this
 6   software and its documentation for EDUCATIONAL purposes
 7   and without fee is hereby granted provided that this
 8   copyright notice appears in all copies.
 9 
10   date   : January 1, 1998.
11   authorĀ : Salih Yurttas.
12
13   a_08.c
14*/
15
16
17#define MAX_SIZE 256
18#define MAX_STRING_SIZE 64
19
20char get_char(char*);
21
22int get_data(char**);
23
24char** replace_with_upper(char**, int);
25
26void print_animals(char**, char**, int);
27
28enum YN {Yes='Y',
29         No='N'};
30typedef enum YN YN;
31
32int main(int argc, char *argv[]) {
33
34  char **animals,
35       **u_animals;
36
37  int i,
38      number_of_animals;
39
40  animals = (char**) malloc(MAX_SIZE);
41
42  for(i=0; i<MAX_SIZE; i++)
43    animals[i] = (char*) malloc(MAX_STRING_SIZE);
44
45  do {
46    number_of_animals = get_data(animals);
47
48    u_animals = replace_with_upper(animals,
49                                   number_of_animals);
50
51    print_animals(animals,
52                  u_animals,
53                  number_of_animals);
54  }
55  while((YN)(toupper(get_char("Yes/No")))=='Y');
56
57}