Numeric addresses for computers on the international networkinternet are compose
ID: 3642877 • Letter: N
Question
Numeric addresses for computers on the international networkinternet are composed of four parts ,seperated by periods,of theformxx.yy.zz.mm
where xx,yy,zz,and mm are positive integers.Locally,computersare usually known by a nickname as well.you are designing a programto process a list of internet addresses,identifying all pairs ofcomputers from the same locality.Create a structure type calledaddress_t with components for the four integers of an internetaddress and a fifth component in which to store an associatednickname of 10 characters. Your program shouldread a list of up to 100 addresses and nicknames terminated by asentinel address 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 should display a list of messages identifying eachpair of computers from the same locality-that is , each pair ofcomputers with matching values in the first two components of theaddress .In the messages,the computers should be identified bytheir nicknames.
Example Message
Machines platte and green are on the same local network.
Follow the messages by a display of the full list of addressesand nicknames.
Include in your program a scan_address function , aprint_address function ,and a local_address function .Functionlocal_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!
There are 3 files: sample_data.txt, address.h, and address.c
Codes have been successfully tested with gcc compiler.
======================================================
sample_data.txt
111.22.3.44 platte
555.66.7.88 wabash
111.22.5.66 green
0.0.0.0 none
======================================================
address.h
======================================================
address.c
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.