Desired Output:
Code:
Please begin your input:
H
e
l
l
o
<user presses ^D here>
The counts were as follows:
E - 1
H - 1
L - 2
O - 1
Array "a" will gather the input with this code:
(scan, a[], and x are ints)
Code:
        while ((scan = getchar()) != EOF)
        {
                if(scan != '\n')
                {
                        a[x] = scan;
                        x++;
                }
        }
Now, my second array, b[], will have all of its values set to 0.
(b[] and y are ints)
Code:
        for(y = 0; y <= 100; y++)
        {
                b[y] = 0;
        }
I know I need to use another for loop to increase the value of b[z] by one whenever there is a duplicate of an a[] value, but how do I go about doing this? Do I need to use "toascii"? Will a bubble sort help me print this out in alphabetical order or mess up the counting? I know how to do it with a ton of variables and if/switch statements, but the arrays are confusing, help!