PAT 06-2 string uppercase/lowercase conversion, pat06-2
There is nothing to say. Remember to use ctype. h is ready. Tan haoqiang introduced the book. I'm sorry for the old man's family if I don't use it anymore. A little bit of attention should be paid to it. The priority of & is higher than that of =, so getchar () if there are no parentheses on both sides, you will see... I tried to use the output redirection (freopen () to get this character. Well, there is nothing. What is this? It's not a print character. If it's too much, the question setting requirements and code implementation are as follows:
/* Name: Copyright: Author: Date: 31/03/15 20:20 Description: enter a string ending with #. In this case, convert all lowercase letters to uppercase letters, converts all uppercase letters to lowercase letters without changing other characters. Input Format: enter a non-null string with a length not greater than 40 and ended with # in a row. Output Format: output the converted string in one row as required. Input example: Hello World! 123 # output example: hELLO wORLD! 123 */# include <stdio. h> # include <ctype. h> int main () {// freopen ("in.txt", "r", stdin); // for text // freopen ("out.txt", "w ", stdout); // for fun char ch; // while (ch = getchar () // for debug // putchar (1 ); // for fun // ch = getchar (); // for replace while (ch = getchar () & ch! = '#') {If (isalpha (ch) {if (isupper (ch) ch = tolower (ch); else ch = toupper (ch );} putchar (ch); // ch = getchar (); for replace} // fclose (stdin); // for test fclose (stdout); return 0 ;}