An array is an ordered data structure consisting of a collection of elements (values or variables), each identified by one (single dimensional array, or vector) or multiple indexes.
0
votes
2answers
22 views
How to print out one random String from an array
Hi I was wondering how I can print out one random value of an array instead of two of them. Here is my code:
public static void main(String args[])
{
String[] currentRoom;
String[][] rooms = ...
0
votes
1answer
24 views
Java: Subset/indices of array of objects based on object attributes
Let's say I have an array of objects like dummies[] below. I want to find the index of array objects where their attribute a == 5 or a > 3 etc.
class Dummy{
int a;
int b;
public Dummy(int ...
3
votes
2answers
41 views
Alternative to Varargs
I'm implementing a class and its' constructor have to get some Strings as parameters, but I don't know the number of these Strings. I could here pass a vararg parameter (String), but it is a Homework, ...
0
votes
2answers
35 views
Creating a table with PHP foreach function
Ok so I'm in a class called database programming. We got a data set and and put it into our servers. Now I have to use a jquery plugin to help visualize that data. i am using Graph Us plugin and ...
0
votes
1answer
45 views
How can I get c++ to register a keypress, such as the 'F' key?
Along with the above question, how can I 'remember' the press so that if it is pressed again it will undo a particular action. I am making a program that will have moving apples stored within an ...
0
votes
2answers
59 views
Preventing duplicate numbers and asking for user to reenter
Everything I have runs fine, but I am looking for a way to prompt the user if duplicate order number is entered and have them reenter a new order number. Right now it just accepts duplicates and does ...
-1
votes
1answer
46 views
My loop is only giving me the last data input added to the array
I am trying to input a value into an array. My code only gives me the last value in my array.
var data = new Array();
var ColGrid = new Array();
var index = ...
0
votes
2answers
73 views
Index out of bounds for an array list (java)
This is for a homework assignment. I am trying to make a program that searches a text file for specific words and then prints out the frequency of the word.
public class WordFreq extends Echo{
...
-1
votes
2answers
16 views
How to define and assign Verilog 2d Arrays
I'm trying to create a two dimensional array in that form:
reg arr[5:0][0:5];
and when I try to assign a value to it lets say
assign arr[1] = 22;
it gives some errors saying that:
...
2
votes
3answers
49 views
How can I get data of different types from an anonymous class
I have an object that delegates some work to another object which is implementing an interface. Then, I am creating anonymous classes implementing this interface and I would like to get information ...
0
votes
5answers
33 views
separate words like tags php
I want to separate words from 1 line.
I tried this with my following code:
$tags = 'why,what,or,too,';
preg_match_all ("/,(.*),/U", $tags, $pat_array);
print $pat_array[0][0]." <br> ...
0
votes
0answers
37 views
Javascript array sort isn't sorting?
I am trying to sort a Javascript object array based on a custom sort function, the function returns correct values (-1/0/1) as expected, but the sort does not seem to occur.
...
0
votes
2answers
79 views
max of max of an array
I am trying to find which of the 3 teams has the maximum frequency with percentage over 95% in my program but i encounter several problems.First of all i have created a function in order to find the ...
0
votes
1answer
25 views
How can i sort array subarrays by one subarray values? (PHP)
I have an array like this:
array(
'sortBy' => array(0 => 3, 1 => 2, 2 => 1),
'other' => array(0 => 'x', 1 => 'y', 2 => 'z'),
'xxx' => array(0 => 3, ...
2
votes
4answers
38 views
Distinct number of strings in an array, C++
UPDATED WITH FIX
I want to return only the number of unique entries in my array. The array contains a string variable that represents IP address. If there are 10 of them, but of 3 different kinds I ...