#include <fstream>
#include <iostream>
#include <string.h>
using namespace std;
int main(int argc, char* argv[])
{
string s = "all";
string t = "top";
for (int i=1; i<argc ; i++)
{
cout<< argv[i]<< endl;
if( argv[2] != s || t)
{
cout<<"INVALID MODE"<< endl;
return -1;
}
}
}
No viable conversion from 'std::__1::string' (aka 'basic_string, allocator >') to 'bool'Invalid operands to binary
expression ('bool' and 'std::__1::string' (aka 'basic_string, allocator >'))
hello, i am passing command line arguments such as "1 all emptyfile" and "1 top emptyfile", here i want to test if the second argument is not all or top to print out "INVALID MODE". i am having trouble understanding why i cant use the s||t. i get the errors i posted above, is there anyway around this
ive gotten help, thanks to this site, but i have another question, if i have top or all as the second argument, i want it NOT to print out " INVALID MODE". but it seems to be still printout "invalid mode" where in this case all is the second argument, but doesnt seem to print when top is the second argument.
AGAIN thanks so much, another thing i have trouble with, is how to print out "NO PHRASE LENGTH" when no arguments are passed? how does one test that.
also how do i test if the first argument is an integer?, so it if its not an integer and is negative number print out "Invalid phrase length"