codescracker


c++

C++ Program to Get and Display IP Address



« Previous Program Next Program »


Get IP Address in C++

To find/get and display the IP address of your computer in C++ programming, use the function system() and place the command ipconfig after providing the full path of System32 i.e., C:\\Windows\\System32\\ipconfig inside it which calls the windows Command Prompt (cmd) to find/get and display the IP address as shown here in the following program.

C++ Programming Code to Get IP Address

Following C++ program get the IP Address and display it on the screen:

/* C++ Program - Get IP Address */
		
#include<conio.h>
#include<stdlib.h>
void main()
{
	clrscr();
	
	system("C:\\Windows\\System32\\ipconfig");
	
	getch();
}

When the above C++ program is compile and executed, it will produce the following result:

C++ program to get ip address

You can also check it out from SOURCE folder instead of BIN folder (inside SOURCE folder, you can find your program name, click on that to watch the output that will be about your ip address, sample of the output is listed below). This is for "Turbo C" users. Above C++ Programming Example Output (lower part of output):

find ip address using C++ Programming

Above C++ Programming Example Output (upper part of output):

get ip address using C++ Programming

Above C++ Programming Example Output (full part of output):

get ip address in C++ Programming

Same Program in Other Language

You may like the same program in other programming languages:


« Previous Program Next Program »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test