Porzucony/ Szyfr cezara na konkurs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.cpp 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include <iostream>
  2. #include <string>
  3. #include <clocale>
  4. using namespace std;
  5. //Wpisane polskie znaki nie dzia³aj¹
  6. string key="A¥BCÆDEÊFGHIJKL£MNÑOÓPQRSŒTUWVXYZ�¯";
  7. string origin,koniec,part;
  8. int i,j,keyl=key.length();
  9. char de(char input, int shift){
  10. int n=0;
  11. char xd,xdd=key[n];
  12. std::cout << "input:"<<input << '\n';
  13. std::cout << "shift"<<shift << '\n';
  14. while (input != xdd) {
  15. n++;
  16. xdd=key[n];
  17. std::cout << n;
  18. }
  19. xd=key[n+shift];
  20. return xd;
  21. }
  22. int main() {
  23. setlocale(LC_CTYPE, "Polish");
  24. cout << key[18] << '\n';
  25. cout << "Ci¹g do deszyfrowania" << '\n';
  26. cin >> origin;
  27. cout << "Podaj czeϾ zaweirajaca" << '\n';
  28. cin >> part;
  29. char test=de(origin[1], 1);
  30. std::cout <<'\n'<< "de="<< test<< '\n';
  31. // for ( j = 0; j < keyl; j++) {
  32. // cout << j << '.';
  33. // for (i = 0; i < keyl; i++) {
  34. // koniec[i] = de(origin[i], j);
  35. // // std::cout << koniec[i];
  36. // }
  37. // if (koniec.find(part) != std::string::npos) cout <<j<< ".\t" << koniec << '\n';
  38. // }
  39. return 0;
  40. }