Analyzing the structure of the LAN acquaintance

Description Questions
Internet IP address expressed as: xyzm, wherein x, y, z and m are positive integers. You can distinguish each computer on the same local area network by IP address.
Define a structure representing the IP address of the type which comprises four members, namely four integer int. Then enter the two IP addresses, according to whether we determined the first two members of the same value if they are in the same LAN, according to the judgment, outputs "TRUE" or "FALSE" (without the quotes output).
Input
Input consists of two lines, namely two IP addresses.
Output
based on the meaning of problems, output "TRUE" or "FALSE" (without the quotation marks output).
Input Example
192.168.12.34
192.168.24.38
output example
TRUE
data range
entered as integers and strings int within the range, the output string

#include <stdio.h>

struct number
{
	int x;
	int y;
	int z;
	int m;
}s[2];
void main()
{
	int i;
	for(i=0;i<2;i++)
	scanf("%d.%d.%d.%d",&s[i].x,&s[i].y,&s[i].z,&s[i].m);
	if(s[0].x==s[1].x&&s[0].y==s[1].y)
	printf("TRUE");
	else
	printf("FALSE");
}

Guess you like

Origin blog.csdn.net/Lhw_666/article/details/91415518