cannot convert for argument '1'

i am getting an error in passing the function in the last lines of the code any help!
i would suggest that you run the code to know the error guys


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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#include <iostream>


#include <string>
using namespace std;

struct addressBook
{
string name;
string lastName;
string email;
long long phone_num;
int fav;
string groupname;

};

void read(addressBook one);
void read_all(addressBook person[],int Size,int *contact,int *numbr);
void addingMembers (addressBook person[],int Size,int *contact,int *numbr);
void disply(addressBook one);
void disply_all(addressBook person[],int Size,int *contact);
void serchName(addressBook person[],int Size,int *contact);
void delContact(addressBook person[],int Size,int *contact);
void groups(addressBook person[],int Size,int *contact);


void read(addressBook one )
{
    cout <<"enter the first name please:";
cin>>one.name;
cout <<"enter the last name:";
cin>>one.lastName;
cout <<endl;
cout<<"enter the email:";
cin>>one.email;
cout <<endl;
cout<<"enter the phone number or the mobile number:";
cin>>one.phone_num;
cout <<endl;
cout <<"type the number of groups the contact in if he is not type 0:";
cout <<endl;
cin>>one.fav;
if (one.fav>0){
cout <<"type the name of the group:";
cin>>one.groupname;}
}
void read_all(addressBook person[],int Size,int *contact,int *numbr)
{ *contact=0;
    cout <<"how many contact you want to input?"<<endl;
    cin>>*numbr;
    for (int i=*contact;i<*numbr;i++)
    {
        read(person[i]);
        *contact=*contact+1;
    }


}
void addingMembers (addressBook person[],int Size,int *contact,int *numbr){
    cout <<"how many contact you want to add"<<endl;
    cin>>*numbr;
    *numbr=*numbr+*contact;
    for (int i=*contact;i<*numbr;i++)
    {
        read(person[i]);
        *contact=*contact+1;
    }




}







void disply( addressBook one )
{
    cout <<"+--------------------------+"<<endl;
    cout <<one.name<<" "<<one.lastName<<endl;
    cout <<one.email<<endl;
    cout <<one.phone_num<<endl;
    cout <<one.fav<<endl;
    cout<<one.groupname<<endl;
    cout <<"+--------------------------+"<<endl;

}

void disply_all(addressBook person[],int Size,int *contact){

    for (int i=0;i<*contact;i++){
            if (person[i].phone_num!=0){
        disply(person[i]);
        }
    }

}
void serchName(addressBook person[],int Size,int *contact){

    string otherName;
    cout <<"type the name:";
    cin>>otherName;
    cout <<endl;
    for (int i=0;i<*contact;i++){
        if (person[i].name==otherName){
            cout <<person[i].name<<" ";
            cout<<person[i].lastName;
            cout <<endl;
            cout<<person[i].email<<endl;
            cout <<person[i].phone_num<<endl;
            }
    }


}
void nonFavupdate(addressBook person[],int Size,int *contact){
    string othername;
    cout<<"enter the name :";
    cin>>othername;
    for (int i=0;i<*contact;i++)
    {
        if (person[i].name==othername&&person[i].fav==0)
        { cout <<"enter the group name:";
            cin >>person[i].groupname;
            cout<<endl;
        }
        else
        {
            cout <<"this contact is already on a group";
        }
    }

}
void delContact(addressBook person[],int  Size,int *contact){
    char gettingsure;
    cout <<"are you really sure?"<<endl;
    cout<<"(y) to go on (n) to cancel";
    cin >>gettingsure;
    string othername;
    string otherlastname;
    cout <<"enter his first name:"<<" ";
    cin>>othername;
    cout <<"enter his last name";
    cin>>otherlastname;
    cout <<endl;
    for (int i=0;i<*contact;i++){
        if (othername==person[i].name&&otherlastname==person[i].lastName)
        {
            person[i].phone_num=0;

        }
    }




}

void groups(addressBook person[],int Size,int *contact){
    string g;
    cout<<"enter the name of the group:";
    cin>>g;
    cout<<endl;
    int sum=0;

    for (int i=0;i<*contact;i++){
            if (g==person[i].groupname){
                    sum=sum+1;
        disply(person[i]);
        }
    }
    if (sum==0)
    {
        cout<<"there is no match found";
        cout<<endl;
    }

}


int main()
{  int enter,contact=0,numbr;

addressBook person[100];
   cout <<"0-quit the address book"<<endl;
     cout <<"1-enter your address book "<<endl;
     cout <<"2-add more contacts in your address book"<<endl;
    cout <<"3-show contacts from the same group"<<endl;
    cout<<"4-search contact by his name"<<endl;
    cout<<"5- to put a contact into fav"<<endl;
    cout <<"6-delete any contact by his full name"<<endl;


    cin>>enter;
    while (enter!=0){
            if (enter==1){
                read_all(& person,100,&contact,&numbr);
            }
            if (enter==2){
                 addingMembers (&person,100,&contact,&numbr);

            }

            else if (enter==3){
                 groups(&person,100,&contact);
            }
            else if (enter==4){
                serchName( &person,100,&contact);
            }
            else if (enter==5){

                    nonFavupdate( &person,100,&contact);
            }
            else if (enter==6){
                    delContact(& person,100,&contact);

            }
            else if(enter<0||enter>6)
            {
                cout<< "no match found"<<endl;
            }
            cout <<"enter a number from the list"<<endl;
                cin>>enter;

    }


}
Last edited on
change the first parameter from &person simply to person for all lines where you get the error message:
1
2
3
4
5
6
read_all(person,100,&contact,&numbr);
addingMembers (person,100,&contact,&numbr);
groups(person,100,&contact);
serchName(person,100,&contact);
nonFavupdate(person,100,&contact);
delContact(person,100,&contact);
Last edited on
Topic archived. No new replies allowed.