Hi, how are you?
I am a returning student who is suffering from forgetting everything because I didn't use C and C++ after being discharged from the military.
It's so hard because I can't use the class and string in C, but there are a lot of grammar errors when I try to use char[] like Java's String. Is there a way to write or replace char[] as the input/output parameter value of the function?
Nothing is done, but I'm uploading the code just in case.
#include <stdio.h>
char[] enterKeyValue(void){
char key[]; // declaration of key table
printf("Enter key values. Numbers, space, and special letters are not allowed.\n"); // Willingness to make you re-enter numbers, spaces, or special characters when they come in
printf("ABCDEFGHIJKLMNOPQRSTUVWXYZ \n");
printf("|||||||||||||||||||||||||| \n");
printf("vvvvvvvvvvvvvvvvvvvvvvvvvv \n");
scanf_s("%s \n", &key, sizeof(key));
return key;
}
char[] en (char[] key table, char[] sentence to encrypt) {
// Encryption
return encrypted sentence;
}
char[] dec (char[] key table, char[] sentence to be decrypted) {
// Decryption
return 복호화시킨문장;
}
char[] keyCheck(char testValid[]){
// Make sure that the key value is exactly 26 digits
// Check key values for numbers, spaces, and special characters
// Check for duplicate key values
// All alphabets in the key value are capitalized for now
return correct key;
}
int main(){
char key[]; // declaration of key table
int doFunction = 1; // C is dissatisfied with why there is no bullion, but temporary bullion variable created temporarily
while(doFunction == 1){
key = enterKeyValue();
key = keyCheck(key);
// Encryption or decryption
enc(); // Encryption
dec(); // decryption
// I don't know if I'll do it again
If (again) continue;
else doFunction = 0;
}
return 0;
}
intenc(char[] key table, char[] sentence to be encrypted, char[] decrypted sentence)
It should be declared as follows.
Instead of allocating memory to heap within the function, it should be done externally and processed by passing his pointer.
If the key table is an unchanged value, such as a constant, you can also leave it as a global variable/constant.
And the bowl is provided in c99.
https://en.wikipedia.org/wiki/C_data_types#stdbool.h
© 2024 OneMinuteCode. All rights reserved.