Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void dodaj_kontakt(node **head){
- char datoteka[20];
- cout << "Naziv datoteke?" << endl;
- cin >> datoteka;
- fstream file;
- file.open(datoteka, ios::binary | ios::out | ios::app);
- node *current;
- node *new_contact = new node;
- cin.ignore();
- cout << "Unesi ime: ";
- getline(cin, new_contact->name);
- file << "ime: " << new_contact->name << endl;
- cout << "Unesi e-mail: ";
- getline(cin, new_contact->email);
- file << "email: " << new_contact->email;
- new_contact->next = NULL;
- if(!*head)
- {
- *head = new_contact;
- return;
- }
- for(current = *head; current->next; current = current->next);
- current->next = new_contact;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement