PAT 06-2 string uppercase/lowercase conversion, pat06-2

Source: Internet
Author: User

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 ;}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.