![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Programming A discussion forum for programs and programming used in tech-related businesses. |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: May 2008
Posts: 1
OS: XP
|
Please Help me in C array Programe
In often situation you are required to sort the in alphabetic order arrays in the applications , by sorting in the alphabetic order mean arrange the strings according the characters
e.g mani abc pakistan world mbni yahoo The sorted list will be like abc mani mbni pakistan world yahoo This is a bit complex sorting in the all the characters of the string are compared e.g “mani” has come before the word “mbni” , As first character was same then the second character was compared. And according to 2nd character “mani” was place before “mbni” Assignment Your assignment is little simple you will take Names as input , and then sort names according to bases of first character of that Name in ascending order. Details: You will prompt the user to enter the Name1, Name 2, Name3 and up to Name10. You will use arrays/pointers to store the names. Then you will compare the fist character of each Name and then sort the Names. Note you can use any search algorithm you want Here is the sample run of the program Enter the Names: Name1: Abc Name2: Cup Name3: Altavista Name4: Yahoo Name5: Mbni Name6: Sun Name7: Mani Name8: Google Name9: Pakistan Name10: Watan The sorted names are as Abc Altavista Cup Mbni Mani Pakistan Sun Watan Yahoo Hint: • You can apply any sorting algorithm you want. Bubble Sort will be easy, first see that bubble sort for the array of integers. Under stand that and then you can easily change for this scenario. • You will be storing the names some thing like this, char Name[10][25] ; // Ten Names each 25 character long. • You can use loop etc to get input and display output. • You can take input for one name as cin>> name[0]; • You can make strcopy a function to copy one string to another. • You can compare the first latter like this if (name[0][0] == name[1][0] ) or if (name[0][0] > name[1][0] ) or if (name[0][0] < name[1][0] ) |
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) |
|
Manager
Join Date: Sep 2004
Location: Colorado
Posts: 987
OS: Mac OS 9.1, Mac OS X 10.5.8, WinXP Pro, FreeBSD 6.0, Gentoo Linux
|
Re: Please Help me in C array Programe
Bubble sort should be fairly easy for that. What problems are you having with the assignment? If you show us your code so far, we can help you with specific problems, but we will not do the problem for you.
__________________
![]() Has it been a few days since I replied to your thread? Don't panic! I'm a busy college student and may forget a post if I'm extra busy (or it might just take me a while to be able to do a decent reply). If you still need help and are awaiting my reply after a few days, PM me about it. When posting what errors you get, please give the full message. It makes helping you much easier. |
|
|
|
![]() |
| Thread Tools | |
|
|