Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 06-15-2003, 11:44 AM   #1 (permalink)
Rez
Registered User
 
Rez's Avatar
 
Join Date: Jun 2003
Posts: 3
Rez is on a distinguished road
Cool help with C.

I have a problem with C.

Can anyone tell me how to print out an array, in alphabetical, or numerical order?

Say, for example, that you had made a dice rolling game, that assigns 6 random numbers to a single-dimension array. How would you print out the result of each dice roll in ascending, or descending order?

What if you wanted to 'printf', an array of names in alphabetical order?

I can't think of a way to do this, except to use loads 'n' loads of 'strcmp()' functions! lol

I would really appreciate any help you could give.

Thanx. :rock:
Rez is offline   Reply With Quote
Old 06-15-2003, 11:54 AM   #2 (permalink)
joe_bruin
LOAD "*",8,1
 
Join Date: Feb 2003
Location: la.ca.us
Posts: 254
joe_bruin is on a distinguished road
first, sort the array. then iterate though it and print it out.
joe_bruin is offline   Reply With Quote
Old 06-15-2003, 12:00 PM   #3 (permalink)
Rez
Registered User
 
Rez's Avatar
 
Join Date: Jun 2003
Posts: 3
Rez is on a distinguished road
Thanx for the help joe.

I'll give that a try. :rock:
Rez is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
c simple question problem with switch case if13121 Standard C, C++ 1 10-24-2004 10:43 PM
operate overloading member function in C# sureshkumar_kc MS Technologies ( ASP, VB, C#, .NET ) 2 10-15-2004 03:36 AM
For those who have Learned C from "The C Programming Lanuage" DemosthenesB Standard C, C++ 5 07-13-2003 01:22 AM
edit? anon Lounge 10 11-21-2002 04:02 PM


All times are GMT -8. The time now is 12:07 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting