Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- string tp;
- void przepisz(string nazwapliku,bool male,bool duze){
- ifstream pbrany;
- pbrany.open("napisy.txt");
- ofstream pwczytany;
- pwczytany.open(nazwapliku.c_str());
- if(pbrany.good()){
- while(!pbrany.eof()){
- pbrany>>tp;
- if(male){
- if(tp[0]>='a'&&tp[0]<='z'&&tp[tp.size()-1]>='a'&&tp[tp.size()-1]<='z'){
- pwczytany<<tp<<" ";
- }}
- if(duze){
- if(tp[0]>='A'&&tp[0]<='Z'&&tp[tp.size()-1]>='A'&&tp[tp.size()-1]<='Z'){
- pwczytany<<tp<<" ";
- }}
- }
- }
- pbrany.close();
- pwczytany.close();
- }
- int main()
- {
- ofstream plik;
- plik.open("napisy.txt");
- string napis;
- do{
- cin>>napis;
- plik<<napis<<" ";
- }while(napis!="koniec");
- plik.close();
- przepisz("male.txt",true,false);
- przepisz("duze.txt",false,true);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement