Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- #include <string>
- using namespace std;
- void kod(int ilosc,string tab[],string wej){
- for (int i=0;i<ilosc;i++){
- wej.at(i)=toupper(wej.at(i));
- for(int j=0;j<5;j++){
- if (wej.at(i)==tab[j].at(0)){
- wej.at(i)=tab[j].at(1);
- }
- if (wej.at(i)==tab[j].at(1)){
- wej.at(i)=tab[j].at(0);
- }
- }
- }
- cout<<wej;
- }
- int main()
- {
- string wej,literka,wiekszy0,wiekszy1,mniejszy0,mniejszy1;
- string str;
- string ile;
- string tab[]={"GA","DE","RY","PO","LU","KI"};
- string tab1[]={"PO","LI","TY","KA","RE","NU"};
- string tab2[]={"KA","CE","MI","NU","TO","WY"};
- cout<<"Wybierz jeden z kodow:\n1:GA-DE-RY-PO-LU-KI\n2:PO-LI-TY-KA-RE-NU\n3:KA-CE-MI-NU-TO-WY"<<endl;
- //do{
- getline(cin,ile);
- //}while(ile!="1" || ile!="2"||ile!="3");
- cout<<"Podaj ciag wejsciowy:"<<endl;
- getline(cin,wej);
- int ilosc = wej.size();
- if(ile=="1"){
- kod(ilosc,tab,wej);
- }
- if(ile=="2"){
- kod(ilosc,tab1,wej);
- }
- if(ile=="3"){
- kod(ilosc,tab2,wej);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement