473,407 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Sort alphabetic into lower n in ascending order

Sort line
-----------------
Enter a string (1-40 characters): CBA123fde[]aa
Output: aaabcdef


Above is the output i need..but i have done some code...and i dun have idea how to make it...could anyone help show me some easy example...

below is my code...i dont think is correct..please correct me

#include <stdio.h>
#include <stdlib.h>

#define LSIZE 50

int main(void)
{
int i;
char value;
char textInput[50];
int len;

printf("Sort Line\n");
printf("--------------------------------\n");
printf("Enter a string:");


scanf("%s",textInput);

len=strlen(textInput);

for (i=0; i <len; i++) {
value = textInput[i];

if (isalpha(value)){
textInput[i]=value;
}
else if(isdigit(value))
{
textInput-textInput[i];
}else
{
textInput-textInput[i];
}







}
printf("%s\n", textInput);


}



/* loop back until EOF */


Help!!! Urgent
Mar 29 '10 #1
1 2661
jkmyoung
2,057 Expert 2GB
When you do textInput-textInput[i]; do you mean to put in
textInput[i] = ' '
or something like that?
You might want to use a 2nd array to store your output.
Mar 29 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Ken R. | last post by:
Hello all, I am relatively new to python but I am having an issue with custom sort functions.. I am trying to sort a list of lists or tuples with arbitrary ascending or descending sorts. For...
2
by: Alpay Eno | last post by:
Hello all... I'm using asp to get records from an access database, very similar to the way datagrid would work. The title of each column in my table is a link that alternates the sort order between...
13
by: Ian Richardson | last post by:
At the moment I'm using a quicksort algorithm to sort a list of countries in alphabetic order. This worked wonderfully until someone came up with the Åland Islands... and this is at the end of the...
3
by: Petterson Mikael | last post by:
Hi, I have the following package names ( in an xml) that I will transform to html. I need to sort them. <package name="se.company.product.subproduct.boam.fpx.testsignals"> <package...
3
by: happy | last post by:
/* Book name : The prodessional programmers guide to C File name : E:\programs\tc\iti01\ch09\main\01setupm.c Program discription: file setuping -up -Version 01-ver01-W Logic ...
1
by: reiks | last post by:
I have a datatable . My requirement is to sort the table rows in ascending and descending order basing on the columns which I give it. I've used the following expression ...
2
by: Patrick | last post by:
I got a page that loads a xml file into a treeview control. I want it to sort the data before sending it to the treeview control is that possible? <root> <level1 name="" src="" order="0">...
15
by: bcochofel | last post by:
Hi, I want to use a variable to sort elements. That var his passed with query string (I'm using Perl CGI to generate XML). Here's a sample of my output:...
13
by: Vbbeginner07 | last post by:
its about Sorting a list view but its not working. please help....... Private Sub ListView1_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Determine whether the column is the same...
6
by: OldBirdman | last post by:
I have a form, fMain, that displays a single record from a table tMovies. This table has several fields, amongst them Key (PK), Title, DateSeen Also on the form are 2 listboxes and 5 command...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.