1. Engineering
  2. Computer Science
  3. 52 implementation name your program lab2dc use getchar and...

Question: 52 implementation name your program lab2dc use getchar and...

Question details

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, dont use 10 individual counters. . when a character is read in, how to find the corresponding counter? Dont 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 < input.txt 9: 0 red 373 % Submit your program by issuing submit 2031Z lab2 lab2D.c

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution