Thread: Numeric addresses for computers

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    1

    Numeric addresses for computers

    Hi, I need help with writing this program.
    Numeric addresses for computers on the international network Internet are composed of four parts, separated by periods, of the form:

    xx.yy.zz.mm

    where xx, yy, zz, and mm are positive integers. Locally, computers are usually known by a nickname as well. You are designing a program to process a list of Internet addresses, identifying all pairs of computers from the same locality. Create a structure type called address_t with components for the four integers of an Internet address and a fifth component in which to store an associated nickname of upto 10 characters. Your program should read a list of up to 100 addresses and nicknames terminated by a sentinel address of all zeros and a sentinel nickname called "none" (without the quotes).
    The program should display a list of messages identifying each pair of computers from the same locality - that is, each pair of computers with matching values in the first two components of the address. In the messages, the computers should be identified by their nicknames.

    Example Message
    Machines platte and green are on the same local network.

    Include in your program a scan_address function, a print_message function, and a local_address function. The function scan_address should read in all the Internet addresses and the corresponding nicknames. Function local_address should take two address structures as input parameters and return 1 (for true) if the addresses are on the same local network, and 0 (for false) otherwise. Function print_message should display the message specifying which computers are on the same local network.
    Thanks!

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    Okay, what part of it is confusing you? Have you tried anything at all yet? Note that we will not write your program for you.

    -Prelude
    My best code is written with the delete key.

  3. #3
    Im a Capricorn vsriharsha's Avatar
    Join Date
    Feb 2002
    Posts
    192

    Post

    Your program should read a list of up to 100 addresses and nicknames terminated by a sentinel address of all zeros and a sentinel nickname called "none" (without the quotes).
    The program should display a list of messages identifying each pair of computers from the same locality - that is, each pair of computers with matching values in the first two components of the address. In the messages, the computers should be identified by their nicknames.

    Include in your program a scan_address function, a print_message function, and a local_address function. The function scan_address should read in all the Internet addresses and the corresponding nicknames. Function local_address should take two address structures as input parameters and return 1 (for true) if the addresses are on the same local network, and 0 (for false) otherwise. Function print_message should display the message specifying which computers are on the same local network.
    Anymore Functional Requirements Sir.......??
    Help everyone you can

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by great View Post
    Hi, I need help with writing this program.
    Numeric addresses for computers on the international network Internet are composed of four parts, separated by periods, of the form: xx.yy.zz.mm
    Take a look in the Winsock2 libraires... GetHostByName will return the IP address of a host machine from it's name. Build a list of computer names and resolve their IPs and you've got what you want...

  5. #5
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    Don't bump 8 year-old posts!
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Addresses and extracting the value stored at an address
    By donoe_85 in forum C Programming
    Replies: 4
    Last Post: 04-08-2009, 03:38 AM
  2. Replies: 3
    Last Post: 02-26-2008, 02:12 PM
  3. Simple vector class problem, please help
    By fidodidohk in forum C++ Programming
    Replies: 9
    Last Post: 03-30-2007, 09:13 AM
  4. only accept numeric data
    By willc0de4food in forum Windows Programming
    Replies: 6
    Last Post: 08-19-2005, 03:38 AM