String trouble

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jetboy555
    New Member
    • Nov 2006
    • 6

    String trouble

    I'm need my program to read the entire first line from a program. and then write it to an output file.

    ex: Men's Track Meet

    thus far i can only get it to read Men's

    this is using the C++ language

    thanks
  • dav3
    New Member
    • Nov 2006
    • 94

    #2
    try using getline(). I recently encountered a similar situation. getline() worked perfectly.

    Comment

    • Jetboy555
      New Member
      • Nov 2006
      • 6

      #3
      Thanks worked perfectly, but i've got another problem.

      Sample input:

      Men's track Results
      =============== =============== =============== ==
      1999 Danbury 30 Trinity Catholic 35
      2000 Ridgefield 80 Staples High School 50


      I want my program to read the year, and then the names of the schools and ignore the scores. The trouble i'm having is with the names of the schools being more then one word.

      thanks again

      Comment

      • dav3
        New Member
        • Nov 2006
        • 94

        #4
        the only thing i can think of at the moment is ignore(). But I am not sure if you can use that because you want to keep the year..

        Comment

        • Jetboy555
          New Member
          • Nov 2006
          • 6

          #5
          okay i want to keep the scores as well, but the problem is i'm having trouble with schools whose name is longer then one word.

          Comment

          Working...