Thread: lowercase/uppercase conversion help

  1. #1
    Registered User
    Join Date
    Oct 2014
    Posts
    1

    lowercase/uppercase conversion help

    Hello,

    I am having trouble in creating a program (named "up.c") that should do the following:

    - if you run the command ("up") with no arguments, it should read input from stdin and display it on stdout, converting lowercase letters to uppercase.

    - if you run the command with one or more files (as arguments to the "up" command), your program should read input from each file and display it on stdout, again converting lowercase letters to uppercase.

    I'm trying to create a single program that can do both of these, and handle errors gracefully. I've found that some codes work to convert the letters, but they seem overly simple and aren't giving me what I'm looking for in my program. Can anyone help me?

  2. #2
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    Break your problem down into little steps, and solve them one at a time. Plan out your program on paper first, before you even go near the compiler. When you have a plan, begin writing code - but only write a little bit at a time, compiling and testing as you go. Build up your program gradually and methodically.

    A development process

    Do you know how to handle user input? If not, review that material before you proceed.

    Do you know how to handle command line arguments? If not, review that material before you proceed.

    I've found that some codes work to convert the letters, but they seem overly simple and aren't giving me what I'm looking for in my program.
    No "finding" code that already does what you need. Write it yourself. Start simply, and grow your program gradually. That is the only way you'll learn how to program.

    That is the best I can offer, until you buckle down and make a earnest attempt yourself. When you get stuck on a particular point, post back and explain exactly where you're stuck. Include all relevent information, as well as your code (in code tags).
    Last edited by Matticus; 10-15-2014 at 04:58 PM.

  3. #3
    Registered User
    Join Date
    Apr 2013
    Posts
    1,658
    Quote Originally Posted by Dylan Dynes View Post
    run the command with one or more files (as arguments to the "up" command)
    Learn how to use argc and argv.

    Quote Originally Posted by Dylan Dynes View Post
    convert the letters
    Take a simple case, how could you convert 'a' to 'A', how could you convert 'z' to 'Z' ?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 10-01-2014, 07:43 PM
  2. how to detect a lowercase or uppercase char?
    By Axel in forum C Programming
    Replies: 5
    Last Post: 09-04-2005, 12:28 PM
  3. Uppercase and lowercase
    By StarOrbs in forum C++ Programming
    Replies: 4
    Last Post: 03-09-2005, 04:18 PM
  4. Uppercase & Lowercase
    By Dennis in forum C Programming
    Replies: 2
    Last Post: 11-14-2002, 08:07 AM
  5. converting chars to uppercase/lowercase
    By Unregistered in forum C++ Programming
    Replies: 4
    Last Post: 05-08-2002, 07:55 PM

Tags for this Thread