Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. void dodaj_kontakt(node **head){
  2. char datoteka[20];
  3. cout << "Naziv datoteke?" << endl;
  4. cin >> datoteka;
  5. fstream file;
  6. file.open(datoteka, ios::binary | ios::out | ios::app);
  7. node *current;
  8. node *new_contact = new node;
  9.  
  10. cin.ignore();
  11. cout << "Unesi ime: ";
  12. getline(cin, new_contact->name);
  13. file << "ime: " << new_contact->name << endl;
  14. cout << "Unesi e-mail: ";
  15. getline(cin, new_contact->email);
  16. file << "email: " << new_contact->email;
  17. new_contact->next = NULL;
  18.  
  19. if(!*head)
  20. {
  21. *head = new_contact;
  22. return;
  23. }
  24. for(current = *head; current->next; current = current->next);
  25. current->next = new_contact;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement