go to previous page   go to home page   go to next page

Answer:

No. You typically would not have hard-wired data like this program has.


New Program

Complete Capitalize Program

Here is a new problem:

Problem: Write a program that reads characters from standard input and writes characters to standard output. Each alphabetic character should be a capital letter on output.

Usually standard input is the keyboard and standard output is the monitor. The flowchart has been modified to match this new problem.

The grain size of this problem is (again) single characters. The input/output functions used should match the grain size. getchar() reads single characters from standard input.

int getchar()
return the next character from the input stream as the low-order byte of an int. The function returns the character or EOF when End Of File is reached.

The constant EOF is defined in the header file stdio.h as a 32-bit pattern, usually 0xFFFFFFFF (all 1-bits). This is because all 8-bit patterns are legitimate values that might be read from a file and getchar() might easily return any of them. getchar() works with binary files, not just text file.

It is a common mistake to try to use char variables with getchar() and putchar(). This will not always work.


QUESTION 9:

Is the new flowchart structured?