Jump to content
xisto Community
Sign in to follow this  
scan06disk

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

Recommended Posts

hi guys,

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

0 1 2 3 4 5 6 7 8 930 ! " # $ % & '
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

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. :unsure:

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

Share this post


Link to post
Share on other sites

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:

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

Share this post


Link to post
Share on other sites

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 followsi 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 :)eg. 0 1 2 330 !40 50CheersScan :)

Share this post


Link to post
Share on other sites

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 followsi 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 :)
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.

Share this post


Link to post
Share on other sites

Hi hitman,hmm... well its like a table with all multiples of ten in the left column and the preceding numbers on the top row304050 0 1 2 3means 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 :)

Share this post


Link to post
Share on other sites

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.

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

Share this post


Link to post
Share on other sites

Hi hitmanblood,AWE MAN thx for taking your time just to do this, ITS PERFECT JUST WHAT I WANTED :D :D

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://forums.xisto.com/no_longer_exists/
i converted some huge pictures and impressed my friends lol
one actually believed i made it all manually lol :):(
:( :( :(:) :) :P:D:P:(:):P

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.