Code writing help

Hi everyone,i have this program for an school assignment. the goal of program is that encodes the user name part of a given e-mail address and creates a password.

I put only encode parts of my program because I couldn't wirte second encode part.Can anyone help me to write second part according my task?
I did first part as you can see on my code but I stuck in second part please help me.

My task:

Encoding Steps:
1. Replace any vowels (i.e., "a", "e", "i", "o", "u") in the user name with their ASCII values.
For example, if the user name is "canangunicen", then you have to replace "a" with "97", "u" with "117", "i" with "105", and lastly "e" with "101". Thus, the encoded version becomes "c97n97ng117n105c101n". After this process is done, you have one more step to finish the encoding.
2. When the first part of the encoding is finished, in the encoded string, you will have only digits and consonants (e.g., "c97n97ng117n105c101n"). Now, you have to encode the consonants as follows:
a. For each consonant in the encoded user name, if you can find the same character in the provider name, then you will replace it with the one that is on the left side of the found character in the provider name. For example:
user name = canangunicen
provider name = sabanciuniv
After the vowels are replaced with their corresponding ASCII values, the encoded string will be the following:
c97n97ng117n105c101n
Then, you will replace the consonants according to their positions in the provider name. For instance, if you are processing 'c' currently, you would find the position of 'c' as 5 in the provider name. Thus, in the encoded string, you will replace 'c' with 'n', since 'n' is the character which is on the left side of 'c' in the provider name. At this point, the encoded string will become "n97n97ng117n105c101n".
If you find the character you are searching for at the 0th index in the provider name, then in the encoded string, you have to replace it with the last character of the provider name.
If the character you are searching for exists in multiple positions in the provider name, then you have to consider the one with the smallest index.
b. For any consonant in the user name, if you cannot find the same character in the provider name, then you will replace it with the first character of the provider name.
For example, since there is no 'g' in the provider name, the encoded string will become "n97a97as117n105c101n" after processing 'g' in the encoded user name.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
void encodePart1()
{
	for(int i = 0; username[i]; i++)
	{
		string s = encoding[username[i]];
		if(!s.empty())
			password += s;
		else
			password.append(1, username[i]);
	}
}

/*
 *	Encoding part 2.
 * */ 
void encodePart2()
{
	
}

int main() 
{
	encoding['a'] = "97";
	encoding['e'] = "101";
	encoding['i'] = "105";
	encoding['o'] = "111";
	encoding['u'] = "117";
	
	while(readEmail());
	
	encodePart1();
	encodePart2();
	
	cout << password << endl;
	return 0;
}
Topic archived. No new replies allowed.