Add to Google

Ascii Help Pls Fast ! :( - ASCII HELP PLS FAST !! :(

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > Java, Java Servlets, Java Script, & JSP

Ascii Help Pls Fast ! :( - ASCII HELP PLS FAST !! :(

scan06disk
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.



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

Notice from truefusion:
Please use edit feature instead of double posting. Thank you.

 

 

 


Reply

hitmanblood
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();

        }


    }

}

 

 

 


Reply

scan06disk
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

Reply

hitmanblood
QUOTE(scan06disk @ May 14 2007, 11: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


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.

Reply

scan06disk
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

Reply

hitmanblood
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();

        }


    }

}

Reply

scan06disk
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

Reply

v36rox
QUOTE(scan06disk @ May 15 2007, 09:37 AM) *
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

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

Similar Topics

Keywords : Ascii Pls Ascii Pls


    Looking for ascii, pls, fast, ascii, pls, fast,






*SIMILAR VIDEOS*
Searching Video's for ascii, pls, fast, ascii, pls, fast,

*MORE FROM TRAP17.COM*
advertisement



Ascii Help Pls Fast ! :( - ASCII HELP PLS FAST !! :(