How do I make CMD apps read letters individually on one line of text!

closed account (iG3b7k9E)
Please HELP, I'm making an app that takes random letters like, "K jcxg k ecv.", and translates them into words like, "I have a cat."
Can anyone help me and show me how to make my win32 app read the letters individually and translate them. PLEASE HELP???
Last edited on by admin
What are you reading the letters from? the user or a file? or...
closed account (iG3b7k9E)
What ever the user pasts or types there.
okay would you want it to take the entire string then translate or translate during the typing process?
closed account (iG3b7k9E)
Translate the entire string after the user presses enter.
closed account (iG3b7k9E)
Can someone please help me as soon as possible please?
So you're wanting to en/decrypt text?

What type of method do you want, some people use what's called a "rolling code" where each character changes by it's position number (ie: aaa = bcd, OR abc = bdf). Some people use bit toggle or possibly bitshift (i'm struggling with this myself so cant help you here)

Think of HOW you want the text to be changed and then it's simple enough going through each character with a for() loop for the string position.

(if you don''t understand this right now think of how you want to change your characters and i'll help the best i can)
closed account (iG3b7k9E)
I want to be able to write one entire line of text and then press enter and have it change it all into something else.
closed account (iG3b7k9E)
Can someone tell me how to do this soon. I have been waiting for one day and a half.
closed account (iG3b7k9E)
I still need help.
Fine fine, I'm gonna show you the rolling code method cos its nice and easy and also effective.
1
2
3
4
5
6
7
Void encrypt(string phrase){
    For(int I =0; I < phrase.size(); I++){
        Phrase[i] += (I+1);
    }
    Cout phrase;
Return;
}


All you need todo is pass a string to this function and it'll encrypt it for you, example: encrypt("Hello There!");
To decrypt just copy the code to make another function with a different name and swap += for -= and it should work fine.
closed account (iG3b7k9E)
I tried to do that but when I directed int main() to the void encrypt(string phrase) it kept saying 'string phrase unidentified'. Then I tried to make it direct it like this: encrypt(); and then it said 'too few arguments'. Do you know how to fix that or another way to do it?
Yes, i assumed you would know how to declare a simple string.
in you main function or globally you need to create ANY string to be able to send it to the function...

1
2
3
4
5
6
int main(){
    string str; //Create a string named "str"
    cout << "Enter some text to encrypt: "; //Ask for text
    getline(cin, str); //Assign "str" to whole line input from console
    encrypt(str); //Send str to the encrypt function which will also output new str
}


This is the simplest way todo this and should not create any errors
Last edited on
closed account (iG3b7k9E)
I tried that but it keeps saying 'encrypt': identifier not found
Topic archived. No new replies allowed.