RoDBoT: BETA

This is a discussion on RoDBoT: BETA within the C++ Programming forums, part of the General Programming Boards category; Something like... Code: while(userInput != "goodbye") { bool found = false; while (getline(check, temp)) { stringstream format; format << temp; ...

  1. #31
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Something like...
    Code:
    while(userInput != "goodbye")
    {
        bool found = false;
        while (getline(check, temp))
        {
            stringstream format;
            format << temp;
            format >> index >> temp;
            
            if (userInput == temp)
            {
                while (getline(answr, comparestring))
                {
                    stringstream convert;
                    convert << comparestring;
                    convert >> comparenum;
                    
                    
                    getline(convert, comparestring);
                    if (comparenum == index)
                    {
                        cout << comparestring << endl;
                        user();
                        found = true;
                    }
                    
                }
            }
        }
        
        if (found == false)
            // Error msg
    }
    ?

  2. #32
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    thats the idea, but its the blasted loop, it will say the error as it loops looking for a match.

  3. #33
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    Originally posted by RoD
    thats the idea, but its the blasted loop, it will say the error as it loops looking for a match.
    how about adding another bool 'done' which is set to true when a full line of input is parced.

    Code:
     
    bool done = false;
    
    // when your done with one full line of input set done to true then...
    
    if (!found && done)
         // error message.
    this way the error message wont get displayed at each iteration.

  4. #34
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    fixed that part, major thnx to eibro, moving on!

Page 3 of 3 FirstFirst 123
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beta version compiled with -DWINVER=0x0500
    By wow in forum Windows Programming
    Replies: 3
    Last Post: 03-20-2006, 07:35 AM
  2. MS Visual Studio .NET 2005 beta 1
    By Vader in forum C++ Programming
    Replies: 8
    Last Post: 09-21-2004, 08:14 PM
  3. Natrual Language Programming - Beta Release
    By andy668 in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 01-16-2002, 01:24 AM
  4. Visual Studio .NET beta 2
    By Marky_Mark in forum C++ Programming
    Replies: 1
    Last Post: 11-05-2001, 11:28 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21