Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help Please. Newbie at work. Failing.
#6
(10-08-2009, 08:19 AM)TheDoctor Wrote: When I use your code, it stills gives me an error :S
Error : In member function ‘std:Confusedtring User::Check(std:Confusedtring)’:
AND
warning: control reaches end of non-void function

???
It works though, thanks. Kind of weird output when I enter the wrong name, but still Big Grin

I don't get that error, but you can avoid the error by changing string Check() to int Check() and make it return true or false

Code:
int Check(string x)
      {
           string com = Name;
           if ( com == x)
           {
                return 1;
           }else{
                return 0;      
           }
      }


Then you call Check within an if condition
Code:
if(user->Check(x))
  {
      cout << "You made it. Congratz" <<endl;
  }

If the function returns true you output the message


http://www.ibm.com Wrote:This warning is similar to the warning described in Return with no value. If control reaches the end of a function and no return is encountered, GCC assumes a return with no return value. However, for this, the function requires a return value. At the end of the function, add a return statement that returns a suitable return value, even if control never reaches there.
Reply


Messages In This Thread
RE: Help Please. Newbie at work. Failing. - by Gaijin - 10-08-2009, 09:57 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)