View Single Post
Old 09-23-2005, 03:08 PM   #10 (permalink)
josh2two
Registered User
 
Join Date: Sep 2005
Posts: 22
josh2two is on a distinguished road
thanks so much everyone, this is the final code

char alphabet[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '\0'};

char message[LENGTH +1], temp;
int i;
cout<<"Enter a string: ";
cin>>message;
message[0] = toupper(message[0]);
cout<<"After capitalizing the first letter of this string it becomes: "<< message<<"\n";
message[strlen(message) -1] = toupper(message[strlen(message) -1]);
cout<<"After capitalizing the last letter of this string it becomes: "<< message<<"\n";
for(i=0; i < alphabet[i]; ++i)
if(message[0] == alphabet[i])
{
message[0] = alphabet[(i+3)%strlen(alphabet)];
break;
}
cout<<"After adding three to the first letter of this string it becomes:"<< message<<"\n";
temp = message[0];
message[0] = message[strlen(message) -1];
message[strlen(message) -1] = temp;
cout<<"After swapping the first and last letters of this string it becomes:"<< message<<"\n";
system("PAUSE");
system("CLS");
josh2two is offline   Reply With Quote