Computing.Net > Forums > Programming > using for loops to interate unicode

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

using for loops to interate unicode

Reply to Message Icon

Original Message
Name: gimmpy225
Date: June 10, 2005 at 21:35:49 Pacific
Subject: using for loops to interate unicode
OS: Windows XP Pro
CPU/Ram: athlon 64 3000+ / 1 gig
Comment:

k im new and i just want to make a program that uses for loops to somehow interate and print out every unicode symbol from 0001 to 9999.

basically all i can come up with is I would need to use:

public static void main(String[] arguments) {

String[] A = new String[9999];

int count = 0001;

for(i=0;i<=9998;i++){
A[i] = "

and use a for loop to iterate through the array printing out every unicode symbol.
The two things i cant figure out is how to
1. use for loops to put the unicode numbers into each cell of the array.
2. make it so they all print like 20 symbols to a line or all on the same line.


For inserting the numbers i came up with this:

int i,a,z,x;

for(i=0;i<10;i++)
{

System.out.println(i);

for(a=0;a<10;a++)
{

System.out.println(a);

for(z=0;z<10;z++)
{

System.out.println(z);

for(x=1;x<10;x++)
{
System.out.println(x);
}
}
}
}
}
}
The System.out.println's are there just so I could see if it would hop out of the for loop and iterate in the next highest one.

thats just to make it got 0001 0002 0003 0004 and so on up to 9999, but what i cant figure out is how to take that 0001 and put it into the cell A[0] of the string array 0.0


can you help me out here?

sry for my sloppy explanation of where im at, even im confused on how i was trying to solve it.

and the nested for loops work like the odometer on a car like they should, but how do i tie the 2 i want together to make it iterate through the array while inserting the proper value into each slot?

one thing that came to my mind was a thread, buuuttt im not to familiar with the language yet.

:::note:::
this isnt hw (summer break) just a little something i wanted to do to see all the unicode symbols and to fool around with for loops :)

GIMPS


Report Offensive Message For Removal


Response Number 1
Name: Michael J (by mjdamato)
Date: June 10, 2005 at 22:34:50 Pacific
Reply: (edit)

Not sure what language you are using, I'm not familiar with it. But, from your logic I can see that you are trying too hard - you are making this more difficult than it needs to be.

You only need to create one for loop to print the unicode characters (no need for an array) and just use one additional variable as a counter to put a line break after every 20 characters.

Using some of the syntax you have above I will try to illustrate, but as I said I'm not familiar with that language. Items in bold are for you to figure out.

int i,j
j = 0

for(i=0;i<=9999;i++){

if (j==20) {
System.out.println(lineBreak);
j = 0;
}

System.out.println(unicodeFormat[i]);

j++
}


Report Offensive Follow Up For Removal

Response Number 2
Name: gimmpy225
Date: June 10, 2005 at 23:05:23 Pacific
Reply: (edit)

omg i cant believe i didnt post it was java lol, man it is getting late 0.0

and im new to java not programming, i got into MFC with c++ and decided id learn java for my browser based game i intend to oneday make ^_^

GIMPS


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge
Poll History




Data Recovery Software