Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
ceeszz
ceeszz's Profile
3
Posts
3
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
how can I sort a 2d array???
[0 Replies]
19-Oct-2012 02:12 AM
Forum:
Programming Questions
never mind I find it out!!!!
yeaaaa buddy!!!!!!!!
code:
String examplearray[][] = new String[5][3];
examplearray[0][0] = "hey";
examplearray[0][1] = "1";
examplearray[0][2] = "8";
examplearray[1][0] = "blabla";
examplearray[1][1] = "5";
examplearray[1][2] = "122";
examplearray[2][0] = "meh";
examplearray[2][1] = "3";
examplearray[2][2] = "88";
examplearray[3][0] = "axax";
examplearray[3][1] = "9";
examplearray[3][2] = "88";
examplearray[4][0] = "ababa";
examplearray[4][1] = "9";
examplearray[4][2] = "88";
size(300, 300);
println(int(examplearray[0][0]));
println(int(examplearray[1][0]));
String alfa[]= new String[2];
String alfa2[] = new String[2];
String a[] = new String[examplearray[0].length];
String b[] = new String[examplearray[0].length];
int alfabetisch = 0;
while(alfabetisch<examplearray.length-1)
{
alfa[0]=examplearray[alfabetisch][0];
alfa[1]=examplearray[alfabetisch+1][0];
alfa2[0]=examplearray[alfabetisch][0];
alfa2[1]=examplearray[alfabetisch+1][0];
alfa =sort(alfa);
if (alfa[0] != alfa2[0]) {
a= examplearray[alfabetisch];
b= examplearray[alfabetisch+1];
examplearray[alfabetisch] = b;
examplearray[alfabetisch+1] = a;
alfabetisch=0;
}
else
{
alfabetisch++;
}
}
String x[] = new String[examplearray[0].length];
String z[] = new String[examplearray[0].length];
int checkrow;
for (int kolom=1; kolom<examplearray[0].length; kolom++) {
checkrow = 0;
while (checkrow<examplearray.length-1) {
if (int(examplearray[checkrow][kolom]) < int(examplearray[(checkrow+1)][kolom])) {
x = examplearray[checkrow];
z = examplearray[checkrow+1];
examplearray[checkrow]= z;
examplearray[checkrow+1]=x;
checkrow=0;
}
else
{
checkrow++;
}
}
}
for (int i = 0; i<examplearray.length; i++) {
for (int t=0; t<examplearray[i].length; t++) {
text(examplearray[i][t], 20+60*t, 20+20*i);
}
}
how can I make a random array, that has a random value which occurs only once per array
[4 Replies]
17-Oct-2012 08:14 AM
Forum:
Programming Questions
how can I make a random array, that has a random value which occurs only once per array.
int[] randomarray = new int[18];
int check;
for (int i = 0; i<18; i++) {
check=0;
randomarray[i] = int(random(0, 20));
while (check<18) {
if (randomarray[i] == randomarray[check]) {
randomarray[i] = int(random(0, 20));
check=0;
}
else {
check++;
}
}
}
thanks in advance! :)
how to string[][] to int
[6 Replies]
17-Oct-2012 05:52 AM
Forum:
Programming Questions
hey,
I want to calculate with a 2d string, how do I have tot do this??
It have to be a string[][] for me!
String[][] meh = new String[5][8];
for(int i=0; i<meh.length; i++){
meh[i]="1";
}
for(int i=0; i<meh.length; i++){
int(meh[i][1])++;
}
«Prev
Next »
Moderate user : ceeszz
Forum