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:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* 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
Go Back   Tech Support Forum > The IT Pro > Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Programming A discussion forum for programs and programming used in tech-related businesses.

Reply
 
LinkBack Thread Tools
Old 05-17-2008, 01:31 PM   #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
Google
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] )
flame82 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
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

Old 05-17-2008, 10:39 PM   #2 (permalink)
Manager
 
shuuhen's Avatar
 
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

My System

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.
shuuhen is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 07:11 PM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85