Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <set>
- #include <algorithm>
- using namespace std;
- set<char> c;
- void Add(set<char>& s)
- {
- char a;
- ifstream file ("example.txt",ios::in);
- while(!file.eof())
- {
- file>>a;
- if(s.insert(a).second)
- cout<<"Inserted "<<a<<endl;
- else
- cout<<"Already exists"<<endl;
- }
- cout<<"Insertion complete!"<<endl;
- system("pause");
- system("cls");
- }
- void Print(set<char>& s)
- {
- set<char>::iterator it;
- for(it=s.begin();it!=s.end();it++)
- cout<<*it<<" ";
- }
- set<char> alphabet;
- set<char> v;
- set<char>::iterator it;
- void AddAlpha(set<char>& s)
- {
- char letter='a';
- for(letter='a';letter<122;letter++)
- {
- s.insert(letter);
- }
- }
- int main()
- {
- AddAlpha(alphabet);
- Add(c);
- Print(c);
- cout<<endl;
- it=set_difference(c.begin(),c.end(),alphabet.begin(),alphabet.end(),v.begin());
- cout<<"There is "<<v.size()<<" letters not used!"<<endl;
- cout<<"\nThey are: "<<endl;
- Print(v);
- cout<<endl;
- system("pause");
- return 0;
- }
Add Comment
Please, Sign In to add comment