Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   Encrypting User Given String (http://www.go4expert.com/forums/encrypting-user-string-t29649/)

AnnRose 1May2013 01:17

Encrypting User Given String
 
Hi all. I am working on a program where a user first enters a string of 26 characters, they then choose the number of lines they'd like to use with a length of 40. I have it working as far as it encrypting a string that I enter into the code, but I don't know how to make it encrypt whatever input the user gives, nor do I know how make the program know how many lines they've chosen to use. I am a beginner/novice at C++, so any help would be greatly appreciated. Thank you in advance. This is the code I have so far:
Code:

#include <iostream >
using namespace std;
void encrypt(char[]);


int main( )
{
int userinput;   

char string[ ] = "USeriNPut";


cout << "The Decrypted String is: " << string << endl;
encrypt(string);

cout << "The Encrypted String is: " << string << endl;

return 0;
}

void encrypt (char x[] )
{
for( int i=0; x[i] != '\0'; ++i ) ++x[i];
}



All times are GMT +5.5. The time now is 21:47.