View Single Post
Old Apr 13th, 2005, 12:12 AM   #1
TecBrain
Hobbyist Programmer
 
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 4 TecBrain is on a distinguished road
replace space with ' * '

If the user input a space the output should be replaced with a ' * ', Not seems to except, I have added the value 32 which represent the space value on the ASCII table,However; if I replace the value of 32 to 33 which represent ' ! ' char, it would work, Any idea!!


void strencypt(char str[])
{
	char star='*';
	char str2[10];
	int i;
	
	for(i=0;((i<10) && (str[i]!='\0'));i++)
	{
			if ((int)(str[i])==32)
			str2[i]= star;
	
			else str2[i]=(int)(str[i]+1);

	}
	
	std::cout << "String A Is Encrypted Now With This Format: " << "\n";
	
	for(i=0;((i<10) && (str[i]!='\0'));i++)
	{
		std::cout << str2[i];
	}
	std::cout << "\n";
	
}
__________________
Personal Portfolio
TecBrain Support Forum
Linux VS Windows ... Dont Even Think of it ..
Distribution: Slackware
if (OS==Linux) return success
There are 10 kinds of people, those who can read binary numbers and those who can't.
TecBrain is offline   Reply With Quote