Home » Archimedes archive » Acorn User » AU 1994-09.adf » !Extras_Extras » c/Prog5

c/Prog5

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1994-09.adf » !Extras_Extras
Filename: c/Prog5
Read OK:
File size: 010A bytes
Load address: 0000
Exec address: 0000
File contents
/* Program 5 */
#include <stdio.h>

main()
{                           /* Set up the variables used */
  char i;

  printf("Please input a letter ");
  scanf("%s",&i);
  switch (i);
  { case 'a' : printf("Apple"); break;
    case 'b' : printf("Banana"); break;
  }
}
00000000  2f 2a 20 50 72 6f 67 72  61 6d 20 35 20 2a 2f 0a  |/* Program 5 */.|
00000010  23 69 6e 63 6c 75 64 65  20 3c 73 74 64 69 6f 2e  |#include <stdio.|
00000020  68 3e 0a 0a 6d 61 69 6e  28 29 0a 7b 20 20 20 20  |h>..main().{    |
00000030  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000040  20 20 20 20 20 20 20 2f  2a 20 53 65 74 20 75 70  |       /* Set up|
00000050  20 74 68 65 20 76 61 72  69 61 62 6c 65 73 20 75  | the variables u|
00000060  73 65 64 20 2a 2f 0a 20  20 63 68 61 72 20 69 3b  |sed */.  char i;|
00000070  0a 0a 20 20 70 72 69 6e  74 66 28 22 50 6c 65 61  |..  printf("Plea|
00000080  73 65 20 69 6e 70 75 74  20 61 20 6c 65 74 74 65  |se input a lette|
00000090  72 20 22 29 3b 0a 20 20  73 63 61 6e 66 28 22 25  |r ");.  scanf("%|
000000a0  73 22 2c 26 69 29 3b 0a  20 20 73 77 69 74 63 68  |s",&i);.  switch|
000000b0  20 28 69 29 3b 0a 20 20  7b 20 63 61 73 65 20 27  | (i);.  { case '|
000000c0  61 27 20 3a 20 70 72 69  6e 74 66 28 22 41 70 70  |a' : printf("App|
000000d0  6c 65 22 29 3b 20 62 72  65 61 6b 3b 0a 20 20 20  |le"); break;.   |
000000e0  20 63 61 73 65 20 27 62  27 20 3a 20 70 72 69 6e  | case 'b' : prin|
000000f0  74 66 28 22 42 61 6e 61  6e 61 22 29 3b 20 62 72  |tf("Banana"); br|
00000100  65 61 6b 3b 0a 20 20 7d  0a 7d                    |eak;.  }.}|
0000010a