Wrox Programmer Forums
|
Java Basics General beginning Java language questions that don't fit in one of the more specific forums. Please specify what version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 31st, 2007, 02:19 AM
Registered User
 
Join Date: Jul 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default accending order

please help me on this one,,, this is the problem
 "create an assembly program that accept char input with maximum of 10 chars and arrange it in accending order"

ex: ENTER A STRING:"BANANA"
    IN ACCENDING ORDER:"AAABNN"


that`s how the program work
 
Old August 1st, 2007, 01:22 AM
Authorized User
 
Join Date: Oct 2006
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, I can suggest you the following piece of code

-------------------------------------------------
 for (int i = 0; i < str.length(); i++) {
       for (int j = i + 1; j < str.length(); j++ ) {
         if (str.charAt(i) > str.charAt(j)) {
          replaceChar1 = str.charAt(i);
          replaceChar2 = str.charAt(j);
          str.setCharAt(i, replaceChar2);
          str.setCharAt(j, replaceChar1);
           }

       }
     }

-------------------------------------------------

Type of str here is StringBuffer

Best,
Anna
 
Old August 1st, 2007, 02:26 AM
Registered User
 
Join Date: Jul 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yah! in JAVA.... what if in ASSEMBLY PROGRAMMING...???????
how do you progaram that..????






maron19a

 
Old August 1st, 2007, 03:03 AM
Authorized User
 
Join Date: Oct 2006
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oops, sorry :)
I haven't noticed. Topic was under the Java
 
Old August 3rd, 2007, 02:56 AM
Registered User
 
Join Date: Jul 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Get the string into a char array using
getChars() in String class
and then sort it by using
java.util.Array.sort()

 
Old August 28th, 2007, 10:49 PM
Authorized User
 
Join Date: May 2007
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ur expecting code in assembly language or in java?

http://studyjava.org/forums/





Similar Threads
Thread Thread Starter Forum Replies Last Post
ORDER BY Help U.N.C.L.E. SQL Server 2000 13 September 2nd, 2008 09:07 PM
ORDER BY a column? gilgalbiblewheel Classic ASP Databases 1 March 30th, 2005 10:37 AM
Order By with Union agarwalmk SQL Language 3 February 18th, 2004 11:33 AM
Order by on a subform bjackman Access 1 January 16th, 2004 01:22 PM
document node order vs sort node order. ladyslipper98201 XSLT 2 June 5th, 2003 11:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.