Guest User

Untitled

a guest
Jan 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <C:/VCPP/header.h>
  2. #define D "C:/VCPP/bestanden/oefenbestand.txt"
  3.  
  4. int invoer(string naam[])
  5. {
  6. int i=0;
  7. cout<<"Naam: ";
  8. cin>>naam[i];
  9. i++;
  10. while(naam[i]!="/")
  11. {
  12. i++;
  13. cout<<"Naam: ";
  14. cin>>naam[i];
  15. }
  16. return(i);
  17. }
  18. void schrijven(int aantal, string naam[])
  19. {
  20. ofstream bestand; // declaratie van het logische bestand
  21. bestand.open(D,ios::app); // nickname voor het fysieke bestand
  22. if(bestand.is_open())
  23. {
  24. for(int i=0; i<aantal; i++)
  25. {
  26. cout<<naam[i]<<endl;
  27. bestand<<naam[i]<<endl;
  28. }
  29. bestand.close();
  30. }
  31. else
  32. cout<<"Bestand kon niet geopend worden";
  33.  
  34.  
  35. }
  36.  
  37. void main()
  38. {
  39. string naam[20];
  40. int aantal=invoer(naam);
  41. schrijven(aantal, naam);
  42. _getch();
  43. }
Add Comment
Please, Sign In to add comment