전체 글 (44) 썸네일형 리스트형 [C++] 파일 암호화 및 복호화 프로그램 소스 코드 이 프로그램은 암호화와 암호 해독의 두 가지 옵션을 제공합니다. 기본 XOR 암호를 사용하여 사용자가 제공한 키를 사용하여 지정된 입력 및 출력 파일에 대한 암호화 및 복호화 작업을 수행합니다. 이 예제에서는 교육 목적으로 간단한 XOR 암호를 사용합니다. 실제로는 안전한 파일 암호화를 위해 더 고급 암호화 알고리즘을 사용해야 합니다. 소스코드 #include #include #include using namespace std; // Function to perform XOR encryption/decryption void xorCipher(ifstream& inFile, ofstream& outFile, const string& key) { char byte; size_t keyIndex = 0; wh.. [C++] 소수 판별 프로그램 이 프로그램을 사용하면 사용자가 범위(시작 및 끝 숫자)를 입력하면 해당 범위 내의 모든 소수를 생성하여 표시할 수 있습니다. 소스코드 #include #include using namespace std; // Function to check if a number is prime bool isPrime(int num) { if (num [C++] palindrome 예제 소스코드 이 프로그램은 사용자에게 문자열을 입력하라는 메시지를 표시한 다음 입력한 문자열이 공백과 대소문자를 무시하고 앞뒤로 똑같이 읽는 팔린드롬(palindrome) 문자열인지 확인합니다. 소스코드 #include #include #include using namespace std; // Function to check if a string is a palindrome bool isPalindrome(string str) { // Remove spaces and convert to lowercase str.erase(remove_if(str.begin(), str.end(), ::isspace), str.end()); transform(str.begin(), str.end(), str.begin(), ::tol.. 이전 1 ··· 9 10 11 12 13 14 15 다음