#include <iostream>#include <cstdio>#include <cstdlib>using namespace std;void andrew();void kaitlin();void maincmptr();void mshome();void other();string msgx; //For message inputstring msgquote = "\"";string entermsgdirects = "Enter your message you wish to send, then press ENTER to send it:\n";int main (){ system("title Simple Messenger v2.0 BETA -- Press CTRL + C to exit at any time."); system("color 4f"); int menuinput; cout << "Please select a number from the menu to send a message to that computer.\n"; cout << endl << "1. Andrew\n2. Kaitlin\n3. Main\n4. MSHOME (all computers)\n5. Other (Specify IP or Name)\n6. Exit\n"; cin >> menuinput; switch(menuinput) { case 1: { andrew(); } break; case 2: { kaitlin(); } break; case 3: { main(); } break; case 4: { mshome(); } break; case 5: { other(); } break; case 6: { return 0; } break; default: { system("CLS"); cout << "************Invalid Entry. Please Try Again.************\n"; main(); } break; }}void andrew(){ system("CLS"); cout << entermsgdirects; cin >> msgx; //get msg to send string command("net send /DOMAIN:andrew \""); //string for system() string msgquote("\""); system ((command + msgx + msgquote).c_str()); //Puts the string 'command' and the message 'msgx' together cout << "Press enter to return to the menu.\n"; system("pause>NUL"); system("CLS"); main();}void kaitlin(){ cout << entermsgdirects; cin >> msgx; string command("net send /DOMAIN:kaitlin \""); system ((command + msgx + msgquote).c_str()); cout << "Press enter to return to the menu.\n"; system("pause>NUL"); system("CLS"); main(); return;}void maincmptr(){ cout << entermsgdirects; cin >> msgx; string command("net send /DOMAIN:main \""); system ((command + msgx + msgquote).c_str()); cout << "Press enter to return to the menu.\n"; system("pause>NUL"); system("CLS"); main();}void mshome(){ cout << entermsgdirects; cin >> msgx; string command("net send /DOMAIN:mshome \""); system ((command + msgx + msgquote).c_str()); cout << "Press enter to return to the menu.\n"; system("pause>NUL"); system("CLS"); main();}void other(){ std::string ip; //For IP address input std::string name; // For computer name input int iporname; cout << "I would like to specify:\n1. An IP address\n2. A computer name\n"; cin >> iporname; switch(iporname) { case 1: { cout << "Enter the IP of the computer you wish to send a message to:\n"; cin >> ip; cout << entermsgdirects; cin >> msgx; string command("net send "); //string for system() string nbsp(" "); //just a space for the system() system((command + ip + nbsp + msgquote + msgx + msgquote).c_str()); //puts that 'command' string, the 'addr' string, the space, and the message 'msgx' together for the system() call cout << "Press enter to return to the menu.\n"; system("pause>NUL"); system("CLS"); main(); } break; case 2: { cout << "Enter the NAME of the computer you wish to send a message to:\n"; cin >> name; cout << entermsgdirects; cin >> msgx; string command("net send /DOMAIN:"); //string for system() string nbsp(" "); //just a space for the system() system((command + name + nbsp + msgquote + msgx + msgquote).c_str()); //puts that 'command' string, the 'addr' string, the space, and the message 'msgx' together for the system() call cout << "Press enter to return to the menu.\n"; system("pause>NUL"); system("CLS"); main(); } break; } main();}