IPB

Welcome Guest ( Log In | Register )



Tags
This content has not been tagged yet
 
Reply to this topicStart new topic

Ascii Help Pls Fast ! :(

, ASCII HELP PLS FAST !! :(


scan06disk
no avatar
Member [Level 2]
*****
Group: Members
Posts: 80
Joined: 12-April 07
From: Aussieland
Member No.: 41,495



Post #1 post May 13 2007, 08:13 AM
hi guys,

i really want to know how to make a ASCII table like this.

QUOTE
0 1 2 3 4 5 6 7 8 9
30 ! " # $ % & '
40 ( ) * + , - . / 0 1
50 2 3 4 5 6 7 8 9 : ;
60 < = > ? @ A B C D E
70 F G H I J K L M N O
80 P Q R S T U V W X Y
90 Z [ \ ]^ _ ` a b c
100 d e f g h i j k l m
110 n o p q r s t u v w
120 x y z { | } ~ ? ?


rows and cloumns.
[hr=noshade] [/hr]

this is what i have done so far

CODE
public class DisplayChars {

    public static void main(String[] args) {
        int value;
        for (int j=0; j<= 9; j += 1)
        System.out.print("\t" + j);

         for (int i = 30; i <= 120; i+= 10) {
         value = ((char)i);
         System.out.print("\n" + i + "\t" +(char)i);                                                                                        
         }
    }

}


and i cant get the ASCII characters to line up. sad.gif

[note=truefusion]Please use edit feature instead of double posting. Thank you.[/note]
Go to the top of the page
+Quote Post
hitmanblood
no avatar
Privileged Member
*********
Group: [HOSTED]
Posts: 786
Joined: 13-April 07
From: mreža
Member No.: 41,558



Post #2 post May 14 2007, 09:04 AM
Well you should explain it better or at least provide the assignments statement here.

But you haven't so I tried to firgure out what actually you want to do and I wrote small code it would be cool if you would explain what is wrong so I could help you further if this is not satisfactory also I would like to say that you may contact me via personal message if I am not fast enough to answer your inquiry and please include link to the topic.

Here is the code:

CODE
public class displayChars {

    public static void main(String[] args) {

        int counter = 0;
        int starter = 32;

        for(int i = 0; i <= 9; i++){

            System.out.print(i + "0" + " ");

            for(int j = 0; j < 10; j++){

                System.out.print((char)(counter + starter) + " ");
                counter++;

            }

            System.out.println();

        }


    }

}
Go to the top of the page
+Quote Post
scan06disk
no avatar
Member [Level 2]
*****
Group: Members
Posts: 80
Joined: 12-April 07
From: Aussieland
Member No.: 41,495



Post #3 post May 14 2007, 09:40 AM
oh thank you very much but i left it for the last minute hehe, so what i wanted to do was to align it as follows
i wanted to align each value for example 33 is ! so 0 1 2 3 is top row and side is the well you probably get it hehe, Thank you very much biggrin.gif
eg.

0 1 2 3
30 !
40
50

Cheers
Scan biggrin.gif
Go to the top of the page
+Quote Post
hitmanblood
no avatar
Privileged Member
*********
Group: [HOSTED]
Posts: 786
Joined: 13-April 07
From: mreža
Member No.: 41,558



Post #4 post May 14 2007, 12:57 PM
QUOTE(scan06disk @ May 14 2007, 11:40 AM) [snapback]324499[/snapback]
oh thank you very much but i left it for the last minute hehe, so what i wanted to do was to align it as follows
i wanted to align each value for example 33 is ! so 0 1 2 3 is top row and side is the well you probably get it hehe, Thank you very much biggrin.gif
eg.

0 1 2 3
30 !
40
50


I am sorry to say that I don't see correlation between 33 and 0123456789 because every character in ascii table has it sown place and by that every character has his uniqe number following that no numbers are correlated to the 33 except only one.

But if you wanted to do it like the in the first raw numbers from 0 till nine and in the first column numbers from the 30 till 120 then write in each of these intersections related number I will do it for you in some hour time because now I have training which I have to attend.
Go to the top of the page
+Quote Post
scan06disk
no avatar
Member [Level 2]
*****
Group: Members
Posts: 80
Joined: 12-April 07
From: Aussieland
Member No.: 41,495



Post #5 post May 14 2007, 01:55 PM
Hi hitman,

hmm... well its like a table with all multiples of ten in the left column and the preceding numbers on the top row

30
40
50
0 1 2 3

means 0 =30 u know like multiplication tables this multi that but in this case 0 = to that left column number (30, 40,50...)
as for 0123 1=31,41,51...... so the table in between displays the ASCII value of 31 32 33 below 0 1 2 3 in line with 30 left column.

THANK YOU VERY VERY MUCH for all your help!!
scan biggrin.gif
Go to the top of the page
+Quote Post
hitmanblood
no avatar
Privileged Member
*********
Group: [HOSTED]
Posts: 786
Joined: 13-April 07
From: mreža
Member No.: 41,558



Post #6 post May 14 2007, 03:33 PM
OK here is your solution I will explain it firstly in few words.

I declared first two variables which will be used in the program later on in the code then I added several blank spaces so that table looks nice so that it would have ordered columns and raws.

Then I printed the first raw in the first for loop. And later on moved pointer to the new line. Then I used two for loops one in the other which made one for the columns that is the first one and second for the raws. So first loop is looping trough columns pointer is switched to the new line at the end of each cycle. Then there are if statements that is only one if else statemnet which determines whther it is three decimal number or two and if it is two then it adds one more blank space and if it is three decimal then it adds only one. I did this to keep the order of the raws and columns.

Then there is second or inner for loop which loops trough the raws and by making this it is in fact writing out characters.

I also had in mind to correct it so you wouldn't see the last two question marks but as you had them in your example table I though that this is not needed.

Good luck with your project hopefully I was helpful.

CODE
public class helptest {

    public static void main(String[] args) {

        int counter = 0;
        int starter = 30;

        System.out.print("    ");

        for(int i = 0; i <= 9; i++){

            System.out.print(i + " ");

        }

        System.out.println();

        for(int i = 3; i <= 12; i++){

            if(i >= 10){

                System.out.print(i + "0 ");

            }else{

                System.out.print(i + "0  ");

            }

            for(int j = 0; j < 10; j++){

                System.out.print((char)(starter + counter) + " ");

                counter++;

            }

            System.out.println();

        }


    }

}
Go to the top of the page
+Quote Post
scan06disk
no avatar
Member [Level 2]
*****
Group: Members
Posts: 80
Joined: 12-April 07
From: Aussieland
Member No.: 41,495



Post #7 post May 15 2007, 02:37 PM
Hi hitmanblood,


AWE MAN thx for taking your time just to do this, ITS PERFECT JUST WHAT I WANTED biggrin.gif biggrin.gif

Have a Great Day !

Cheers !!
Scan
Go to the top of the page
+Quote Post
v36rox
no avatar
Newbie [Level 1]
*
Group: Members
Posts: 19
Joined: 15-May 07
Member No.: 43,151



Post #8 post May 15 2007, 02:57 PM
QUOTE(scan06disk @ May 15 2007, 09:37 AM) [snapback]324634[/snapback]
Hi hitmanblood,
AWE MAN thx for taking your time just to do this, ITS PERFECT JUST WHAT I WANTED biggrin.gif biggrin.gif

Have a Great Day !

Cheers !!
Scan


hey just to let you know there is a really neet program that converts any picture to ascii.
right here if u want http://www.lennybacon.com/image2ascii/
i converted some huge pictures and impressed my friends lol
one actually believed i made it all manually lol smile.gif smile.gif
sad.gif smile.gif mad.gif rolleyes.gif dry.gif laugh.gif biggrin.gif wink.gif ohmy.gif huh.gif tongue.gif
Go to the top of the page
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   3 Zlash 524 11th July 2007 - 10:49 PM
Last post by: Striker9099
No new   44 Becca 4,414 9th January 2005 - 12:36 AM
Last post by: mirianda
No New Posts 4 spawn_syxx9 566 2nd December 2004 - 07:05 PM
Last post by: Someone
No New Posts 2 synapticflame 710 8th December 2004 - 09:44 PM
Last post by: Becca
No new   17 vietonline 2,089 23rd June 2008 - 11:03 PM
Last post by: samlockart
No New Posts   1 bizchina 658 30th December 2004 - 03:09 PM
Last post by: mrkill47
No New Posts   13 ICE-XG 1,236 26th January 2005 - 08:28 PM
Last post by: ashmaninc
No new   182 linkey 11,314 5th August 2007 - 09:14 PM
Last post by: GamerGlitch
No New Posts   6 no9t9 431 12th March 2005 - 07:15 PM
Last post by: no9t9
No New Posts   10 truman69 813 13th March 2005 - 01:16 PM
Last post by: Becca
No New Posts   3 hulunes 1,624 20th April 2005 - 08:59 AM
Last post by: hulunes
No new   28 truman69 1,425 23rd August 2006 - 04:38 AM
Last post by: HiDDeNMisT
No New Posts   1 50Dime 362 10th July 2006 - 03:53 AM
Last post by: BuffaloHELP
No New Posts   7 -darkelfcn- 495 24th February 2005 - 04:18 PM
Last post by: -bassweb-
No New Posts   2 -hellomyfriends- 325 9th December 2004 - 03:22 PM
Last post by: -welbis-