Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <C:/VCPP/header.h>
- #define D "C:/VCPP/bestanden/oefenbestand.txt"
- int invoer(string naam[])
- {
- int i=0;
- cout<<"Naam: ";
- cin>>naam[i];
- i++;
- while(naam[i]!="/")
- {
- i++;
- cout<<"Naam: ";
- cin>>naam[i];
- }
- return(i);
- }
- void schrijven(int aantal, string naam[])
- {
- ofstream bestand; // declaratie van het logische bestand
- bestand.open(D,ios::app); // nickname voor het fysieke bestand
- if(bestand.is_open())
- {
- for(int i=0; i<aantal; i++)
- {
- cout<<naam[i]<<endl;
- bestand<<naam[i]<<endl;
- }
- bestand.close();
- }
- else
- cout<<"Bestand kon niet geopend worden";
- }
- void main()
- {
- string naam[20];
- int aantal=invoer(naam);
- schrijven(aantal, naam);
- _getch();
- }
Add Comment
Please, Sign In to add comment