Variable problem in C++
Hi!
How do i do if I want to give a variable a value consisting of some text and a variable? Like
string hello, ip = 127.0.0.1; hello = "PING "+ip;
Or if I want to run the system command with both text and a variable like
string ip = 127.0.0.1; system("PING"+ip);
Sry if I wrote something wrong, I'm kinda new to this… Please help me :)
Thx
you could use the system commands like
system(ping 127.0.0.0); and loop it if your trying to attempt a ping of death.
or
#include <iostream>
int main() { int counter; std::cout << "How many times to ping?: "; std::cin >> counter; while (counter > 0) { system("Ping 127.0.0.0"); counter–; } std::cout << "you pinged: " << counter << "\n"; system("PAUSE"); return 0; }
of couse where the ip = 127.0.0.0 you might wanna change to the one your pinging