Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <cstdlib>
- #include <iostream>
- using namespace std;
- int main()
- {
- string plik_in, plik_out;
- cout << "Plik wejsciowy: ";
- cin >> plik_in;
- cout << "Plik wyjsciowy: ";
- cin >> plik_out;
- ifstream input;
- ofstream output;
- input.open(plik_in.c_str());
- output.open(plik_out.c_str());
- if(input.fail() || output.fail())
- {
- cout << "blad pliku" << endl;
- return 0;
- }
- int n = 5;
- char znak;
- while(!input.eof())
- {
- input.get(znak);
- if(isalpha(znak))
- {
- // zmiana znaku
- znak += n;
- while(!isalpha(znak))
- znak -= 26;
- }
- output << znak;
- }
- input.close();
- output.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment