Thread: when to use a class

  1. #1

    when to use a class


    I have a function written that will read a file and output the file with the length of each line. I want to parse each line until I get a specific character, then continue to read the line until the end of the line.

    I have each line when used, stored in a string. Should I try to implement a class to parse the string? Or is there an easier way to do this???


  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    I suppose you could use a class to hide the "tokenize" part. class FileLine or something. Sure, why not.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3

    Arrow let me try again

    Let's see:

    What I really want to do is to make a new file that will have the previous character string on the left side or the "token". Next I want to continue to read the same string. Next, I want to break the right side into smaller parts between white space characters and print a new line with the left side, token, right side.


    Input file:
    12 ? a g e

    This is my desired output:

    12 ? a
    12 ? g
    12 ? e


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Class design problem
    By h3ro in forum C++ Programming
    Replies: 10
    Last Post: 12-19-2008, 09:10 AM
  2. Two conceptual questions
    By AntiScience in forum C++ Programming
    Replies: 3
    Last Post: 11-01-2007, 11:36 AM
  3. Defining derivated class problem
    By mikahell in forum C++ Programming
    Replies: 9
    Last Post: 08-22-2007, 02:46 PM
  4. matrix class
    By shuo in forum C++ Programming
    Replies: 2
    Last Post: 07-13-2007, 01:03 AM
  5. Abstract class problem
    By VanJay011379 in forum C++ Programming
    Replies: 9
    Last Post: 07-31-2002, 01:30 PM