C program that will search all donors with the same type

I'm a C beginner I need your help. I have a school project program about BLOOD DONOR RECORDS and I want to store it in files and will display all donors with the same blood type, like all type O donors, all type A donors all type b donors and all type AB donor. I really need help..TNX

I think you should read this first.
http://www.cplusplus.com/forum/beginner/1/
This is part of my code
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
//donor information
struct donor_info{
    char surname[20];//-|
    char middle[3];//   |->NAME
    char first[20];//  _|
    char gender[2];
    int BD_month, BD_day, BD_year; //BD-BirthDate
    char contact_num[12];
    char email_add[50];
    char blood_type[3];
    int DB_month, DB_day, DB_year; //DB-DateBleed
    int ED_month, ED_day, ED_year; //ED-Eligibility Date
    struct donor_info *next;
};
struct donor_info *head, *tail;

//donors with blood type O
struct Type_O{
	char surname[20];//-|
    char middle[3];//   |->NAME
    char first[20];//  _|
    char gender[2];
    int BD_month, BD_day, BD_year; //BD-BirthDate
    char contact_num[12];
    char email_add[50];
    char blood_type[3];
    int DB_month, DB_day, DB_year; //DB-DateBleed
    int ED_month, ED_day, ED_year; //ED-Eligibility Date
	struct Type_O *next;
};
struct Type_O *O_head, *O_tail;
//In these part, this were I input informations
void Donor_register()
{
    char c;
    int choice;
    int ID;
    int ed;

    struct eligible *E;
    struct donor_info *ptr;
    ptr=(struct donor_info*)malloc(sizeof(struct donor_info));
    while (1){
    if(ptr!=NULL){
        system("cls");
        company();
        printf("\n\tFILL IN THE FORM");
        printf("\n\t\tFirst name: ");
        scanf("%s", &ptr->first);
        fflush(stdin);

        printf("\t\tMiddle name: ");
        scanf("%s",&ptr->middle);
        fflush(stdin);

        printf("\t\tSurname: ");
        scanf("%s",&ptr->surname);
        fflush(stdin);

        printf("\t\tGender(M/F): ");
        scanf("%s",&ptr->gender);
        fflush(stdin);

        printf("\t\tDate of birth(MM DD YYYY): ");
        scanf("%d %d %d",&ptr->BD_month, &ptr->BD_day, &ptr->BD_year);
        printf("\t\t\t%s Date\n", valid_date(ptr->BD_day, ptr->BD_month, ptr->BD_year) ? "Valid" : "Invalid");//Check if the date is valid
        fflush(stdin);

        printf("\t\tContact number: ");
        scanf("%s",&ptr->contact_num);
        fflush(stdin);

        printf("\t\tE-mail add: ");
        scanf("%s",&ptr->email_add);
        fflush(stdin);

        system("cls");
        company();
        printf("\tName:  %s %s. %s\n",ptr->first, ptr->middle, ptr->surname);
        printf("\n\t-----------------------------------------------------");
        printf("\n\tBLOOD TYPE");
        printf("\n\t   Type O\n\t   Type A\n\t   Type B\n\t   Type AB");
        printf("\n\tBlood type: ");
        scanf("%s",&ptr->blood_type);
        fflush(stdin);
        printf("\tDate Bleed(MM DD YYYY): ");
        scanf("%d %d %d",&ptr->DB_month,&ptr->DB_day, &ptr->DB_year);
        printf("\t\t%s Date\n", valid_date(ptr->DB_day, ptr->DB_month, ptr->DB_year) ? "\tVALID\a\a\a" : "\tINVALID\a\a\a");//Check if the date is valid
        ptr->ED_month=eligibility(1,ptr->DB_month, ptr->DB_day, ptr->DB_year);
        ptr->ED_day=eligibility(2,ptr->DB_month, ptr->DB_day, ptr->DB_year);
        ptr->ED_year=eligibility(3,ptr->DB_month, ptr->DB_day, ptr->DB_year);
        fflush(stdin);
        ptr->next=NULL;
        if(tail!=NULL)
        {
            tail->next=ptr;
            tail=ptr;
        }
        else
        {
            tail=ptr;
            head=ptr;
        }
        }
        else
            {
                system("cls");
                printf("Not enough memory!\a\a\a\a\a");
            }
            savefile_donor(*ptr);
            if(ptr->blood_type=="O")
                Type_Oinsert();
            else if(ptr->blood_type == "A")
                Type_Ainsert();
            else if(ptr->blood_type == "B")
                Type_Binsert();
            else if(ptr->blood_type == "AB")
                Type_ABinsert();
            load();
            printf("\n\t\tDONOR REGISTERED SUCCESSFULLY!");
            printf("\n\t\tWISH TO CONTINUE?(Y/N)");
            scanf("%c",&c);
            if(c=='n' || c=='N')
                break;
        }
    }
//DONORS WITH BLOOD TYPE O IS STORED HERE
void Type_Oinsert()//donors with blood type O is inserted into the queue
{
	struct Type_O *ptr;
	struct donor_info *O_ptr;
	ptr=(struct Type_O*)malloc(sizeof(struct Type_O));		//allocates memory space for the linked list
	if(ptr!=NULL)										//if the allocation is successful
	{
        //STORE DONORS WITH BLOOD TYPE O
		strcpy(ptr->first, O_ptr->first);
		strcpy(ptr->middle, O_ptr->middle);
		strcpy(ptr->surname, O_ptr->surname);
        //copy the gender to the type O container
		strcpy(ptr->gender, O_ptr->gender);
        //stores donors birthday to the donors with type O
		ptr->BD_month=O_ptr->BD_month;
		ptr->BD_day=O_ptr->BD_day;
		ptr->BD_year=O_ptr->BD_year;
        //contact number
        strcpy(ptr->contact_num, O_ptr->contact_num);
        //email address
        strcpy(ptr->email_add, O_ptr->email_add);
        //date bleed
        ptr->DB_month=O_ptr->BD_month;
        ptr->DB_day=O_ptr->BD_day;
        ptr->DB_year=O_ptr->BD_year;
        //eligibility date
        ptr->ED_month=O_ptr->ED_month;
        ptr->ED_day=O_ptr->ED_day;
        ptr->ED_year=O_ptr->ED_year;

        ptr->next=NULL;
        if(tail!=NULL)
        {		                    //the insert operation of the queue linked list
            O_tail->next=ptr;		//if the tail is not null insert the node to the end
            O_tail=ptr;
        }
        else
        {
            O_tail=ptr;				//else it is the begining of the queue
            O_head=ptr;				//so the head and tail points to the newnode
        }
    }
    else
    {
        system("cls");
        printf("\t\t\tNot enough memory!\n");		//if the allocation is not successful
    }												//print that there is no memory space
}

This part of the code is were I wanted to condition if were to store the donor with the said blood type
1
2
3
4
5
6
7
8
            if(ptr->blood_type=="O")
                Type_Oinsert();
            else if(ptr->blood_type == "A")
                Type_Ainsert();
            else if(ptr->blood_type == "B")
                Type_Binsert();
            else if(ptr->blood_type == "AB")
                Type_ABinsert();

My problem is how to classify the persons with the same blood type, in storing and searching by type. Sorry for the long post.
Any help will be appreciated.
Topic archived. No new replies allowed.