Skip to content

Commit

Permalink
Create main.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Circuit-Overtime authored Nov 19, 2024
1 parent 45280d2 commit 885da44
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include <bits/stdc++.h>
using namespace std;

void author_list() {
// contributor list
string contributor_names[] = { "Manish", "Ayushman" };// add your name here
int cnt = sizeof(contributor_names) / sizeof(contributor_names[0]);

cout << "\n\n-:: Authors ::-\n";
for (int i = 0; i < cnt; i++) {
cout << " ";
for (char c : contributor_names[i]) {
cout << c;
}
cout << endl;
}
}

void secret_message(const char* encoded, int key) {
int len = strlen(encoded);
char decoded[len + 1]; // initalising char array

for (int i = 0; i < len; i++) {
decoded[i] = encoded[i] ^ key;
}
decoded[len] = '\0'; // null termination marks end of string

printf("Secret Message: %s\n", decoded);
}

int main() {
const char encoded_message[] = { 'K', 'C', 'D', 'C', 'M', 'V', 'N', 'C', 'Q', 'J', '\0' };
int key = 42;

printf("Decoding secret message...\n");
secret_message(encoded_message, key);
author_list();

return 0;
}

0 comments on commit 885da44

Please sign in to comment.