Question: 5.2 Implementation name your program lab2D.c . use getchar and putchar to read from the standard input. The program continues to read until EOF is

5.2 Implementation name your program lab2D.c . use getchar and putchar to read from the standard input. The program continues to read until EOF is entered. Then outputs the occurrence count of each digit in the input. use an integer array as the counters, don't use 10 individual counters. . when a character is read in, how to find the corresponding counter? Don't use statement such as if (c--'0') else if (c--'1") else if (c--'2') else Instead, use the one-statement trick discussed in class, which takes advantage of the index of the character to figure out the corresponding counter in the array 5.3 Sample Inputs/Outputs: (download the input file input.txt) red 368 % gcc -Wall lab2D.c-o lab2d red 369 % lab2d YorkU LAS C D (press ctrl and D) 7: 0 red 370 1ab2d EECS20312 CB121 D (press ctrl and D) 9: 0 red 371 1ab2d EECS3421 thiw is good 3 address 500 yu266074 423Dk D (press Ctrl and D) 8: 0 9: 0 red 372 % lab2d
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
