0

A string is input which is both in uppercase & lowercase letters. How can I arrange the string so that all lowercase letters are in one side and uppercase letters are in another side.

4
Contributors
7
Replies
8
Views
8 Years
Discussion Span
Last Post by Aia
0

For basic ASCII which I presume you will be using, then you can just check the character range. and swap accordingly. IE, 65-90 is capital etc

Chris

0

A string is input which is both in uppercase & lowercase letters. How can I arrange the string so that all lowercase letters are in one side and uppercase letters are in another side.

Upper case characters have the ascii value starting from 65-90 and the lower case characters have the ascii value starting from 97-122.

So i can compare the characters using ascii value and then arrange as you require.

0

I know we have to swap letters according to ASCII code. But is it possible to arrange it one array? Or the result may come in another array?

0

You can do it in one array

char array[3] = {'a', 'C', 'b'};
char temp;
temp = array[2];
array[2] = array[1];
array[1] = temp;

Chris

0

I know we have to swap letters according to ASCII code. But is it possible to arrange it one array? Or the result may come in another array?

yes it is possible to arrange in one array .

0

Do you feel the need to echo me?

It is not uncommon for two people to post about the same solution or idea, without knowing or being aware of each other, since the browser doesn't refresh until the post has been committed.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.