Alphabet to Decimal, assignment help.

I am creating an encryption program, nothing fancy, I have written some working methods that cipher the text as needed and can be reversed as needed by inputting the same values as the encrytion values and manipulating them within the code (these values will be generated by the password).

But I now need to create a key/password that works to encrypt and decrypt the files and I don't know where to start.

So if the user types in "Password" I want to internally convert that to the decimal equivalent e.g. "16 1 19 19 23 15 18 4"

I thought about doing an ASCII conversion but then how do I apply parameters that account for capitals and keep it within the 1-26 bounds?

I found this as a simple method but it throws up "error C2660: 'returnVal' : function does not take 1 arguments" as an error every time

1
2
3
4
5
6
7
8
9
10
11
12
13
14
string UserPassword;
cout << "Enter a Password: ";
cin >> UserPassword;
string s = UserPassword;
for (unsigned int i = 0; i < s.length(); i++)
{
    returnVal(s[i]);
}
return 0;

int returnVal(char x)
{
	return (int)x - 87;
}
Yeah, I wasn't sure which to post it in to be honest
Either would do, the beginners is certainly ok.

Posting the same question more than once tends to be discouraged as it may result in duplicated effort by those forum members who may respond, even trying to solve a problem which is already marked as 'solved' elsewhere on the forum.
Topic archived. No new replies allowed.