Skip to content

Commit

Permalink
Merge branch 'Circuit-Overtime:main' into JISU-2024-0834
Browse files Browse the repository at this point in the history
  • Loading branch information
CoderSagnik00 authored Nov 19, 2024
2 parents 2099bdb + 885da44 commit e0b411b
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,4 @@ To successfully complete the activity, attendees must perform the following step
- Run the main.cpp & note down the secret message.
- The branch name must match your roll number.
- The pull request must not have merge conflicts with the main branch.
- Upload the noted secret message at this form https://forms.gle/vZUjYQtQkCQYieu78 for your attendance.
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 e0b411b

Please sign in to comment.