TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: KURT KUZBA
from: BRIAN WOOD
date: 1998-01-26 11:22:00
subject: `/a`=?

 BW>   cout << "The value of /a is " << '/a' << endl;
 
 KK> You might wish to avail yourself of the string class and
 KK> perform the proper comparisons that way, or use the strcmp()
 KK> function in the standard STRING.H.
 
 KK>       String compare = argv[--arg]
 KK>       cout << "\narg entered was " << endl;
 KK>       if(compare == "/a")
 KK>          cout << compare << endl;
 KK>       else
 KK>          cout << compare << " (unknown)" << endl;
 
 KK> What is a clever use of the environment when you write the
 KK> code, may become a fatal error when you recompile later in
 KK> a different environment.
I understand that, and I appreciate the example!  One reason I really
liked using switch() is because it's easy to add another case...
switch(something) {
   case '/h': case '/H': case '-h': case '-H':
   case '/?':            case '-?':
      // do something
      break;
   case '/x': case '/X': case '-x': case '-X':
      // do someother thing
      break;
   default:
      // do nothin
}
but I guess using your example I could use some ors...?
 KK>       if( compare == "/h" || compare == "/H" ||
               compare == "-h" || compare == "-H" ||
               compare == "/?" || compare == "-?"
           )
              // do the /h thing
           else
           if(compare == "/x" || compare == "/X" ||
              compare == "-x" || compare == "-X"
           )
              // the /x stuff
           else
              // do the default
Thanks for the help.
L8r,
bw
... The computer is incredibly fast, accurate, and stupid....
--- Blue Wave/DOS v2.20
---------------
* Origin: River Canyon Rd. BBS Chattanooga, Tn (1:362/627)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.