Thread: RoDBoT: BETA

  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
    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
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    fixed that part, major thnx to eibro, moving on!

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
Website Security Test