I'm trying to write a sorting algorithm for fun. The problem is that I am having a REALLY HARD TIME translating psudeo-code into real code.

Psudeo code:

if element_X < element_Y
swap element_X, element_Y
X++
Y++
repeat

This is supposed to let me sort from largest to smallest. However, when I try to translate it into code, I run into problems.

Code:
// Includes

#include <iostream>

// Functions

int sort(char one, char two);

// Code

int main(int argc, char* argv[])
{
	char* list = argv[1];
	char temp;
	int retval;
	
	if (argc != 2)
	{
		std::cout << "You input the wrong number of arguments. The correct usage is 'main <list>'.";
		return(0);
	}
	
	for (int x = 0; x < strlen(argv[1]);)
	{
		retval = sort(list[x], list[x+1]);
		
		std::cout << list[x] << list[x+1] << "\t";
		
		if (retval == 1 || retval == 3)
		{
			x++;
		}
		
		if (retval == 2)
		{
			temp = list[x];
			list[x] = list[x+1];
			list[x+1] = temp;
		}
		
		std::cout << list << std::endl;
	}
	
	std::cout << list;
	
	return(0);
}

int sort(char one, char two)
{	
	if (one > two) return(1);
	if (one < two) return(2);
	if (one == two) return(3);
	else return(0);
}
And here's the output of the program.. I STILL can't figure out where it's screwing up.

01 1023456789
10 1023456789
02 1203456789
20 1203456789
03 1230456789
30 1230456789
04 1234056789
40 1234056789
05 1234506789
50 1234506789
06 1234560789
60 1234560789
07 1234567089
70 1234567089
08 1234567809
80 1234567809
09 1234567890
90 1234567890
0 1234567890
1234567890
I would be much oblidged if assistance could be given?