Hi everyone. I would like a little help with this code I'm working on. It's purpose is to ask the user for a computer's IP, a message to be sent, and number of messages. Then it will net send that computer the supplied amount of messages.
The problem I'm having is with this:
How would I make the console understand that a and b are variables. Here is all the code.Code:void sendmsg (string a, string b)
{
system("net send a b");
}
There are probablly a ton of mistakes, but I am definitely a beginner in C++.Code:#include <iostream>
#include <stdio.h>
#include <windows.h>
#include <string.h>
using namespace std;
void sendmsg (string a, string b)
{
system("net send a b");
}
int main(void)
{
string ipaddr;
string msg;
int nummsg;
char cnfrm [1];
int n = 0;
cout << "Enter Computer Name or IP:\n ";
cin >> ipaddr;
cout << "Enter Message:\n ";
cin >> msg;
cout << "Enter Number of Messages to be Sent:\n ";
cin >> nummsg;
cout << "Press y to send the message or n to quit:\n ";
cin >> cnfrm;
if (cnfrm == "y") {
while (n < nummsg) {
sendmsg (ipaddr, msg);
}
}
else
{
exit(0);
}
return 0;
}
Thank you.