#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++)
{
if( i == 2 && (argv[i] != s) && (argv[i] != t))
{
cout<<"INVALID MODE"<< endl;
}
if( i ==1 && (argv[i] != int))
{
cout<<"INVALID PHRASE LENGTH"<< endl;
}
}
}
I know this is horribly wrong, but is there away to do this ? im trying to say that when i =2, meaning argument 2 in a command line, is not all, and not top, to print out InValid mode
along with that, how would i test if an argument is not an integer and if it is not an integer to print out “INVALID PHRASE LENGTH” , but how would i test if the first argument is an integer or negative number