C语言转换大小写

来源:互联网 发布:linux mkdir -m 编辑:程序博客网 时间:2024/05/22 14:33

 

  1. #include <stdio.h>  
  2. #include <ctype.h>  // Contains the tolower prototype  
  3. void main (void)  
  4. {  
  5.     int letter;   
  6.     for (letter = getchar(); ! feof(stdin); letter = getchar())  
  7.         putchar(tolower(letter));  
  8. }  

 

  1. #include <stdio.h>  
  2. #include <string.h>  
  3.  
  4. void main (void)    
  5. {  
  6.     char line[255];  // Line of text read     
  7.     while (fgets(line, sizeof(line), stdin))  
  8.         fputs(strupr(line), stdout);  
  9. }  
  10.  

 

本文出自 “阿凡达” 博客,请务必保留此出处http://shamrock.blog.51cto.com/2079212/878528

0 0