how can i make a program using (struct)

how can i make a program using <structures>

output must be:
Enter your birthday:
zodiac sign is:
lucky color:
lucky number:
message:

the program should only ask the birthday of the user then the zodiac,number,color and message is automatically displayed. the program will not end until the user wants to.
Last edited on
Take an Array of Structure :-

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
typedef struct _DATE_EDGE_
{
  int date;
  char mon[12];
}DateEdge;
typedef struct _SIGNS_
{
  DateEdge Min;
  DateEdge Max;
  char zodiac[15];
  char color[10];
  unsigned short luckyno;
  char message[50];
} Signs;

Signs tmp[12]; //Array of Struct = 12 

for (i=0;i<12;i++)
{
  /* Fill the Structure with mix,max date of each  Sign*/
}

/* now get input from user */
int date;
char month[10];
scanf("%d",&date);
scanf("%s",month);

for (i=0;i<12;i++)
{
  if(!strcmp(tmp[i].min.month,month))
  {
    if(tmp[i].min.date <= date)
    { 
      /* printf Everything for this Struct */
    }
  }
  if(!strcmp(tmp[i].max.month,month))
  {
    if(tmp[i].max.date > date)
    { 
      /* printf Everything for this Struct */
    }    
  }
}
i think it should work
Topic archived. No new replies allowed.