Szyfr kolumnowy
C++
#include <iostream>
#include <string>
using namespace std;
int main()
{
string jawny, szyfrogram = ""; // Poprawna deklaracja zmiennych typu string
int klucz, dl;
cout << "Podaj tekst jawny (bez spacji): ";
cin >> jawny;
cout << "Podaj klucz szyfrowania: ";
cin >> klucz;
dl = jawny.length(); // Zmieniono "długość" na "length" - właściwa nazwa metody w C++
for (int i = 0; i < klucz; i++) {
for (int j = i; j < dl; j = j + klucz) {
szyfrogram = szyfrogram + jawny[j];
}
}
cout << "\nSzyfrogram: " << szyfrogram << endl; // Zmieniono "Szyfrogram" na "szyfrogram" (wielkość liter)
return 0; // Zmieniono "zwróć" na "return" - poprawne słowo kluczowe w C++
}
Output
Embed on website
To embed this program on your website, copy the following code and paste it into your website's HTML:
Comments
This comment belongs to a banned user and is only visible to admins.
This comment belongs to a deleted user and is only visible to admins.