Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include<cstring>
- #include<cmath>
- using namespace std;
- void plot(int x, int a, char znak[], char znak2[], int klucz)
- {
- for(int i=1; i<x; i++)
- {
- if(klucz+a<x)
- klucz=klucz+a;
- else
- klucz=klucz-x+a;
- if(znak[klucz]==' ')
- klucz++;
- znak2[i]=znak[klucz];
- znak[klucz]=' ';
- }
- }
- int main()
- {
- char znak[1000];
- char znak2[1000];
- int a;
- ifstream odczyt("plot.txt");
- int x;
- odczyt>>znak;
- cout<<znak;
- x=strlen(znak);
- odczyt.close();
- int klucz=0;
- cout<<"\nPodaj klucz (ile wierszy): "<<endl;
- cin>>a;
- znak2[0]=znak[klucz];
- znak[klucz]=' ';
- plot(x, a, znak, znak2, klucz);
- ofstream zapis("plot.txt");
- for(int i=0; i<x; i++)
- {cout<<znak2[i];
- zapis<<znak2[i];
- }
- zapis.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement