Encrypt in c ++ | Sololearn: Learn to code for FREE!

+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; }

3/4/2021 2:49:07 AM

Dominycke

4 Answers

New Answer

+2

This is the code, still, thank you very much. https://code.sololearn.com/cNwP2Gnde7HL/?ref=app

+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?

+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 👍

+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