fixed c++ style comments to compile against pure c
This commit is contained in:
parent
2ac96f9563
commit
fa9c07b950
8 changed files with 2 additions and 2 deletions
Binary file not shown.
Binary file not shown.
BIN
bin/3_n_c_userdb
BIN
bin/3_n_c_userdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1 +1 @@
|
|||
#include <stdio.h>
#include <string.h>
#define MAX_LENGTH 31 // 30 characters + '\0' termination
#define SALT 15
int main() {
char input[MAX_LENGTH];
int offset = 0;
char character;
// prompt for input
printf("Please enter message: ");
while (offset + 1 < MAX_LENGTH && (character = getchar()) != '\n') {
input[offset++] = character;
}
input[offset] = '\0';
// encrypt message
for (offset = 0; offset < strlen(input); offset++) {
input[offset] ^= SALT;
}
printf("Encrypted message: %s\n", input);
// decrypt message
for (offset = 0; offset < strlen(input); offset++) {
input[offset] ^= SALT;
}
printf("Decrypted message: %s\n", input);
return 0;
}
|
||||
#include <stdio.h>
#include <string.h>
#define MAX_LENGTH 31 /* 30 characters + '\0' termination */
#define SALT 15
int main() {
char input[MAX_LENGTH];
int offset = 0;
char character;
/* prompt for input */
printf("Please enter message: ");
while (offset + 1 < MAX_LENGTH && (character = getchar()) != '\n') {
input[offset++] = character;
}
input[offset] = '\0';
/* encrypt message */
for (offset = 0; offset < strlen(input); offset++) {
input[offset] ^= SALT;
}
printf("Encrypted message: %s\n", input);
/* decrypt message */
for (offset = 0; offset < strlen(input); offset++) {
input[offset] ^= SALT;
}
printf("Decrypted message: %s\n", input);
return 0;
}
|
|
@ -17,7 +17,7 @@ int main() {
|
|||
int count, offset;
|
||||
|
||||
for (offset = 0, count = 0; offset < MAX_ACCOUNTS; offset++, count++) {
|
||||
printf("Should this user be activated? (0/1/-1): "); // -1 for break input
|
||||
printf("Should this user be activated? (0/1/-1): "); /* -1 for break input */
|
||||
fgets(input_buffer, BUFFER_SIZE, stdin);
|
||||
users[offset].active = atoi(input_buffer);
|
||||
if (users[offset].active == -1) {
|
||||
|
|
Loading…
Add table
Reference in a new issue