If i have two arrays given, one is 200 long and filled with random numbers from 1-6. The other array is 6 long and is suppost to add a star to every field with the same number as is present in the initial array.
I dont understand what you mean by star. Like increment a counter called star?
Daniel Evans
"*" that shit
Liam Bennett
If you need to maintain a separate count for each array element, you are going to need to create an array with the same length as one or both of the arrays.
John Bailey
Explain it correctly dude
Sebastian White
Still not making sense.
David Cooper
Hold up I’ll write you the code
Mason Collins
CS 1.6 was ok, but csgo is worse, because it uses the same engine, fuck you volvo give us source 2 you cheap fucks
Parker Ward
implement a method which takes in a String array and an int array. For every time a number shows up in the int array, add a star (as in String aka "*") to the String array at the postition of that number.
the String thats 200 long is filled with random numbers from 1-6
Eli Carter
Int arr1[] = new int[200]; String arr2[] = new String[6];
//generate rands in arr1 ... //
//add * to arr2 for(int i = 0; i < 200; i++){ arr2[arr1[i]] += "*"; }
Luis Rodriguez
//assume array init is randomly filled with 200 values ranging from 1-6 String[] init int[] OPisaFag; //this is the 6 value long array. for(int k = 0;k < 6;k++){ int min = 0; int max = init.length;
while(max >= min){ int mid = (min + max)/2; if (Integer.parseInt(init[mid]) == OPisaFag[k]) { init[mid] = “*”; } if (Integer.parseInt(init[mid]) < OPisaFag[k]) { min = mid+1; } if (Integer.parseInt(init[mid]) > OPisaFag[k]) { max = mid - 1; } } }
Fuck this was a bitch to type on my phone
Zachary Walker
fuck ignore this nevermind I’ll rewrite it
Thomas James
use math.random
Angel Powell
arr2 just needs to be String[7]
Jacob Jones
Op if you can't do this simple of a program get out of cs now
Daniel Jenkins
Fuckin faggots. I'm gonna write pseudo code because you're all retarded and I'm on my phone. Figure the goddamn indentation out in your own.
int[100] randoms; // this is the array that is filled with random String[6] stars; // this'll be the one for the stars
for (i = 0; i < randoms.length; i++) { stars[randoms[i]] += "*"; }
Jordan Parker
//assume array init is randomly filled with 200 values ranging from 1-6 int[] init; String[] OPisaFag = new String[6];
for(int k = 0;k < 6;k++){ for(int x = 0;x < 200;x++){ if(k == init[x]) OpisaFag[k] += "*"; } }
I don't know man, ask the shit for brains user that posted it
Jaxson Anderson
I read it. I understood it. But it's still retarded. The reason 0 indexing works so well is everything else is also zero indexed. If you do it right, you shouldn't have to worry about it.
Owen Hill
>(int)(Math.random() * 6)+1
Grayson Sullivan
i dunno why this made me chuckle. probably cause im never gonna get over that word
Charles Allen
interesting, i just wanted to see if yall could solve the (easy) question and yall went absolute batshit
Do these not have an index error caused by not accounting for 0?
Elijah Diaz
nevermind I'm retarded.
Jaxson Cooper
//entire program public class OPIsFaggot{ public static void main(String[] args){ String[] count = new String[6]; //assuming 200 int array is called array1 for(int i = 0;i