Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "conio.h"
- #include <fstream>
- using namespace std;
- void main_text()
- {
- cout<<"1. Pisane na tekst vuv fail"<<endl;
- cout<<"2. Chetene na celiqt fail"<<endl;
- cout<<"3. Tursene na informaciq"<<endl;
- cout<<"4. End"<<endl;
- }
- int main()
- {
- int choice;
- fstream file;
- main_text();
- cin>>choice;
- do
- {
- switch(choice){
- case 1:
- {
- file.open("data.dat", ios::out);
- char new_entry[100];
- cout<<"Vuvedete si teksta: ";
- cin.get();
- cin.getline(new_entry, 100);
- file<<new_entry<<endl;
- file.close();
- }
- break;
- case 2:
- {
- file.open("data.dat", ios::in);
- char old_entry[100];
- while (!file.eof())
- {
- file>>old_entry;
- cout<<old_entry<<endl;
- }
- file.close();
- break;
- }
- case 3:
- {
- file.open("data.dat", ios::in);
- char entry[100];
- char search[100];
- cout<<"Koq duma tursite: "; cin>>search;
- while (!file.eof())
- {
- file>>entry;
- if(strcmp(search, entry))
- {
- cout<<entry<<endl;
- }
- }
- file.close();
- break;
- }
- }
- main_text();
- cin>>choice;
- }while(choice != 4);
- return 0;
- _getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement