Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <sstream>
- #include <string>
- cout<<"1 - Add\n";
- cout<<"2 - Search\n";
- cout<<"3 - List All \n";
- cout<<"4 - Edit\n";
- cout<<"5 - Delete\n";
- cin>>choice;
- ofstream out("PhoneBook.txt",ios::app);
- cout<<"\t\t\t Phone Book";
- cout<<"\nEnter the first name: ";
- cin>>fname;
- cout<<"\nEnter the second name: ";
- cin>>lname;
- cout<<"\n\nEnter the phone number";
- cin>>p_num;
- de for add record in text(.txt) fileC++
- ofstream out("PhoneBook.txt",ios::app);
- cout<<"\t\t\t Phone Book";
- cout<<"\nEnter the first name: ";
- cin>>fname;
- cout<<"\nEnter the second name: ";
- cin>>lname;
- cout<<"\n\nEnter the phone number";
- cin>>p_num;
- ofstream out("PhoneBook.txt",ios::app);
- cout<<"\t\t\t Phone Book";
- cout<<"\nEnter the first name: ";
- cin>>fname;
- cout<<"\nEnter the second name: ";
- cin>>lname;
- cout<<"\n\nEnter the phone number";
- cin>>p_num;
- w all record code from text(.txt) fileC++
- ifstream data("PhoneBook.txt");
- cout<<"Enter the name of the person: ";
- cin>>user_input;
- counter = 0;
- while( !data.eof() ) {
- getline(data,record);
- stringstream stream_i(record);
- if (record.find(user_input) != string::npos) {
- while( getline(stream_i,item_i,',') ) {
- contact[counter++] = item_i;
- }
- }
- }
- cout<<"First name:"<<contact[0]<<"\n";
- cout<<"Family name:"<<contact[1]<<"\n";
- cout<<"Phone Number:"<<contact[2]<<"\n";
- ifstream data("PhoneBook.txt");
- cout<<"Enter the name of the person: ";
- cin>>user_input;
- counter = 0;
- while( !data.eof() ) {
- getline(data,record);
- stringstream stream_i(record);
- if (record.find(user_input) != string::npos) {
- while( getline(stream_i,item_i,',') ) {
- contact[counter++] = item_i;
- }
- }
- }
- cout<<"First name:"<<contact[0]<<"\n";
- cout<<"Family name:"<<contact[1]<<"\n";
- cout<<"Phone Number:"<<contact[2]<<"\n";
- Search record code from text(.txt) fileC++
- cout<<"Enter the name of the person: ";
- cin>>user_input;
- ifstream data("PhoneBook.txt");
- while( !data.eof() ) {
- getline(data,record);
- if (record.find(user_input) != string::npos) {
- cout<<record<<"\n";
- }
- }
- cout<<"Enter the name of the person: ";
- cin>>user_input;
- ifstream data("PhoneBook.txt");
- while( !data.eof() ) {
- getline(data,record);
- if (record.find(user_input) != string::npos) {
- cout<<record<<"\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement