Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The problem is: Numeric addresses for computers on the international networkInte

ID: 3610803 • Letter: T

Question

The problem is:

Numeric addresses for computers on the international networkInternet are composed of four parts, separated by periods, of theform

xx.yy.zz.mm

where xx, yy, zz, and mm are positive integers. Locally, computersare usually known by a nickname as well. you are designing aprogram to process a list of Internet addresses, identifying allpairs of computers from the same locality. Create a structure typecalled address_t with components for the four integers of anInternet address and a fifth component in which to store anassociated nickname of 10 characters. Your program should read alist of up to 100 addresses and nicknames terminated by a sentineladdress of all zeros and a sentinel nickname.

Sample Data:
111.22.3.44        platte
555.66.7.88        wabash
111.22.5.66        green
0.0.0.0               none

The program shoudl display a list of messages identifying each pairof computers from the same locality - that is, each pair ofcomputers with matching values should be identified by theirnicknames.

Example Message:

Machines platte and green are on the same local network.

Follow the messages by a display of the full list of addresses andnicknames. Include in your program a scan_address function.Function local_address should take two address structures as inputparameters and return 1 (for true) if the addresses are on the samelocal network, and 0 (for false) otherwise.



Explanation / Answer

please rate - thanks you were missing a #include then it worked fine-I made no other changes Hope it's in time my run C:UsersDefault.XPS420Desktopcramster>untitled2input.txt I have read 4 line data 111 22 3 44 platte 555 66 7 88 wabash 111 22 5 66 green 0 0 0 0 none platte and green are local computer ! -- true ! C:UsersDefault.XPS420Desktopcramster> #include #include #include typedef struct MY_IP { int xx,yy,zz,mm; char name[11]; } MY_IP; void scan_address(char *namein, MY_IP *ip, int *NN) { FILE *fin; int j,nn=0; int buff_size = 72; char *buff; buff = (char *) malloc(buff_size * sizeof (char)); if ( (fin = fopen(namein,"r") ) == NULL ) { printf("Cann't open input file: %s ", namein);exit(1); }; while (fgets(buff,buff_size,fin) !=NULL){ j = sscanf(buff,"%d.%d.%d.%d %10s", &ip[nn].xx, &ip[nn].yy,&ip[nn].zz, &ip[nn].mm, &ip[nn].name); if (j == 5) nn = nn + 1; }; fclose(fin); *NN = nn; printf("I have read %d line data ",*NN); } // end scan_address void pinrt_address(MY_IP *ip, int NN) { int i; for (i=0;i