+ 1

Encrypt in c ++

I'm having problems with the method, apparently I' entering the input data wrong, what can I do? #include <iostream> #include <cstring> using namespace std; char encrypt ( char text[255] ) { char enctxt [sizeof (text [255])]; char letter; for( int i = 0; i < text[255]; i++ ) { letter = tolower( letter ); if ( letter < 'a' ) letter += 26; } enctxt [i] = letter ; } int main() { char text [255], option; do { cout<<"Text: "; cin.getline( text, sizeof ( text ) ); cout<<text<<endl; cout<<"Other text? (y/n): "; cin>>option; }while(strchr( "Yy", option )); return 0; }

4th Mar 2021, 2:49 AM
Dominycke
Dominycke - avatar
4 Réponses
+ 2
This is the code, still, thank you very much. https://code.sololearn.com/cNwP2Gnde7HL/?ref=app
4th Mar 2021, 6:00 AM
Dominycke
Dominycke - avatar
+ 2
Do you really have to use char array? Can you give me example for input and the expected output? Also, do you prefer to overwrite the input by encrypted text, or would you prefer to work on a different string?
4th Mar 2021, 5:27 AM
Ipang
+ 2
Alright then Can you please mark the thread by adding [SOLVED] to the title? it helps to notify the status of your thread, so people don't post something in arbitrarily 👍
4th Mar 2021, 5:46 AM
Ipang
+ 1
yes, it has to be a char array ... input can be whatever, and it doesn't matter what it shows, but don't worry, I already solved it
4th Mar 2021, 5:44 AM
Dominycke
Dominycke - avatar