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)
|