#include <iostream>
#include <cstdlib>
#include <sstream>
#include <fstream>
using namespace std;
int main(int argc, char* argv[])
{
cout << argv[1] << endl;
if (argv[1]=="-r") cout << "success\n";
}
“success” does not print out. When I run: $ ./hearts -r
the only thing that comes out is:
-r
which makes me sooo confused
You should try using:
to compare the argument with string literal.