'How to make C++ program a Terminal program (UNIX)
I wrote this simple C++ program to compare two strings for a match. Although basic, it's very useful to me as I often need to verify details multiple times a day.
I want to initiate the program with a command name e.g. check4match (the program name) so I can run the program in the terminal.
#include <iostream>
#include <string>
using namespace std;
void match(string, string);
int main() {
string addrOne, addrTwo;
cout<<"Insert str one: "; cin>>addrOne;
cout<<"Insert str two: "; cin>>addrTwo;
match(addrOne, addrTwo);
return 0;
}
void match(string addrOne, string addrTwo){
if(addrOne == addrTwo)
cout<<"SAFE: strings match";
else
cout<<"WARNING: N0 match found";
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
