Thread: String upper-lower case

  1. #1
    Registered User
    Join Date
    Nov 2012
    Location
    Indonesia
    Posts
    8

    String upper-lower case

    Code:
    #include <stdio.h>
    #include <ctype.h>
    
    
    main()
    {
        int c;
        
        while((c=getchar()) !=EOF)
            putchar(tolower(c));
            return 0;
    }
    I tried to convert "LeaRnIng pRogrAm." to "Learning program." (Standard written) using "." to end the input and the first character using Upper case while the others use lowercase .
    but with my code I just can make "learning program."
    how's step to make it, what I need to add to my code? can anyone help me..

  2. #2
    Registered User
    Join Date
    Jun 2009
    Posts
    120
    1. Simply skip calling tolower for the first character of the input.
    2. Add a conditional statement which will end the loop if '.' is encountered.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 11
    Last Post: 04-11-2011, 05:52 PM
  2. Simple program problem from upper to lower case
    By steals10304 in forum C++ Programming
    Replies: 4
    Last Post: 08-12-2009, 02:31 AM
  3. help...Lower and Upper case problem only
    By j4k50n in forum C Programming
    Replies: 9
    Last Post: 04-19-2007, 12:39 AM
  4. upper case to lower case problem
    By Jasonymk in forum C++ Programming
    Replies: 3
    Last Post: 04-27-2003, 05:35 AM
  5. string converting upper/lower
    By jlamn in forum C Programming
    Replies: 9
    Last Post: 09-24-2002, 06:01 PM