Thread: Question about ignoring values

  1. #1
    Registered User
    Join Date
    Oct 2005

    Question about ignoring values

    I am doing an assignment and I am reading a list of numbers from an input file which I am supposed to convert to letters.

    The first number in the file is the offset increment for example if it is 10 than a=10.

    A space is counted if the number is greater than the value for z and a period if the number is less than the value for a. With each space or period the offset is incremented by 1.

    We are only supposed to allow one period or space in a row. How do I set it to count the first space or period and then ignore the following ones?

  2. #2
    Registered User
    Join Date
    Jan 2005
    When you read in each number, you convert it to a letter, right? Then you output that letter or add it to a string or something, right? If the number refers to a second space or period and you are supposed to ignore it, then just don't output it. Use an if statement - if the letter should not be ignored, don't ignore it.

    It is easy to remember if you've seen the space or period already in that row. Just use a bool or int variable that starts at false or 0 every time you start a new row, then when you find a space or period, change it to true or 1. If it is already true or 1, then you know you can ignore it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. question about using returned values
    By pokiepo in forum C Programming
    Replies: 7
    Last Post: 07-02-2008, 12:10 PM
  2. Question about binary trees and files
    By satory in forum C Programming
    Replies: 9
    Last Post: 03-06-2006, 06:28 AM
  3. another exercise question
    By luigi40 in forum C# Programming
    Replies: 3
    Last Post: 11-28-2005, 03:52 PM
  4. Very simple question, problem in my Code.
    By Vber in forum C Programming
    Replies: 7
    Last Post: 11-16-2002, 03:57 PM
  5. Question type program for beginners
    By Kirdra in forum C++ Programming
    Replies: 7
    Last Post: 09-15-2002, 05:10 AM