Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <windows.h>
- using namespace std;
- int main()
- {
- ofstream plik("dane.txt", ios::app);
- string imie, miejscowosc;
- int nr;
- char wybor;
- do
- {
- cout << "Podaj imie:" << endl;
- cin >> imie;
- cout << "Podaj miejscowosc zamieszkania:" << endl;
- cin >> miejscowosc;
- cout << "Podaj numer telefonu:" << endl;
- cin >> nr;
- if(plik.is_open())
- {
- plik << imie << " " << miejscowosc << " " << nr << endl;
- cout << "Zapis udany." << endl;
- }
- else
- {
- cout << "Zapis nieudany. Konczenie programu." << endl;
- break;
- }
- cout << "Czy chcesz dodac kolejna osobe do bazy danych? (T/N)" << endl;
- do
- {
- cin >> wybor;
- }while(wybor!='t' && wybor!='T' && wybor!='n' && wybor!='N');
- system("cls");
- }while(wybor=='t' || wybor=='T');
- plik.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement