Hello, i want to make a categories menu which each will have its own sub-categories and that category will have own sub-categories im trying to make with arrays but i'm not really good at it.. im trying right now with bunch if statements but is there any other method of doing this with loops or something eazier ? <form action="" method="POST"> <?php $category = array("Cars" => 1, "Bikes" => 2, "Phones" => 3); $cars_category = array("Honda" => 1, "BMW" => 2, "Mercedes" => 3); $bikes_category = array("Suzuki" => 1, "GSXR" => 2, "Yamaha" => 3); $phones_category = array("Samsung" => 1, …

so the program needs to dynamically allocate an array large enough to hold a user=defined number of test scores. once all scores are entered, the array should be passed to a function that sorts them in ascending order. another function should be called that calculates the average score. the program should display the sorted list of scores and averages with appropriate headings. use pointer notation rather than array notation whenever possible. the problem i am having is making it so that the program doesn't accept negative numbers for test scores. errors - Error C4716 'showAverage': must return a value ConsoleApplication9 …

Hello, I'm trying to plot this function with using this values: Rh = 9.8 H0 = 0.063 def Thickness_H(H0, r, Rh): return float(H0)*np.exp(float(r)/float(Rh)) r = np.linspace(0,1, 10) x =Thickness_H(H0, r, Rh) plt.plot(r, x) plt.show() I'm trying to defind r like what i know but this dose not work, I'm getting this error: only length-1 arrays can be converted to Python scalars. may you please help me in this point? Thank you

Hello, I was hoping to get some input from anyone in the Java section. My professor gave us a practice problem about two weeks ago and I have been running into an out of bounds error. The program seemed simple enough, take in two arrays of binary numbers from a user, add them, and return the sum as a third array. So far I have this: import java.util.*; public class Binary { public static int[] calculate(int[] arr1, int[] arr2) { int length = (arr1.length + arr2.length); int carry = 0; int[] newArray = new int[length]; for(int i = 0; i …

Hi all,i tried to do some research regarding associated arrays in php,even manual on the php documentations,but can not find the answer,how do i print the smallest value and the associated key from the array?

Trying to insert both of these arrays of random quotes on the same page so that both show at the same time. I realize I have to rename some of the elements within, but apparently I have no clue which. I've tried giving each rannum, ShowText, and RndText a number behind it, but that didn't work. I'm sure there's just something small I'm missing. Any help would be greatly appreciated. Thanks! <div> <!-- Math Conversation --> <script type="text/javascript"> var textarray = [ "The most incomprehensible about Mathematics is that it is comprehensible.", "Arithmetic is where numbers fly like pigeons in …

I am trying to compile the following code and I keep getting a reference error for my output file through a function. The purpose of the program is to read a file, sort through arrays, and output into a certain form. I am sure it is something small, but I do not understand what I am doing wrong. Thanks in advanced for any help. #include <iostream> #include <fstream> #include <string> #include <iomanip> using namespace std; const int runners = 5; const int days = 7; void readFile(ifstream& infile, string names[], double miles[runners][days]); void fileOutput(ofstream& outfile, string names[], double miles[days], double …

So i am back again, working with arrays this time. I can get it to run in the main but i am not sure how to make this code into a void function . #include <iostream> #include <iomanip> #include <string> using namespace std; int main () { // Declare variables and initialize const int monkeytot = 3; const int Wdays = 7; int monkeys; int days; int most = 0; int least = 0; int total = 0; double average = 0; double totaleaten; double food [monkeytot][Wdays]; // start program // Fill array with numbers for (monkeys = 0; monkeys …

I have a class called Car, 6 other classes (Van,Cab,Truck, Taxi, Sedan and Motorbike) that implement this class. Each of the subclasses has its own mnethods and attributes. How would I go about creating an array of these vehicles with the type of car being randomly selected. that is I would like to have an array that looks like this ArrayLaneSouth = {Van,Cab, Taxi, Sedan} ArrayLaneNorth = {Van,Cab, Taxi, Sedan} ArrayLaneWest = {Van,Cab, Taxi, Sedan} ArrayLaneEast = {Van,Cab, Taxi, Sedan} the elements in the arrays are types of cars and the type be selected randomly.

Hey guys, I just learned the very basics of arrays and I have to write this program of a tic-tac-toe game. The requirements are this: Write a modular program that allows two players to play a game of tic-tac-toe. Use a two-dimensional char array with 3 rows and 3 columns as the game board. Each element of the array should be initialized with an asterisk(*). The program should display the initial board configuration and then start a loop that does the following: Allow player 1 to select a location on the board for an X by entering a row and …

Hello, I have the following string [null,null,null],["Paul","2293",1],["eric","2099",0] which I will define as: var dataparsed ='[null,null,null],["Paul","2293",1],["eric","2099",0]'; and would like to construct three different arrays in the following format: var opponentName = new Array(null, "Paul","eric"); var numberVal =new Array(null, 2293,2099); var outComeVal = new Array(null, 1,0); Any ideas on how this can be done in Javascript? I appreciate any thoughts on this. Mossa--

When reading any beginning manual on C++ an array is introduced as follows: float A[10]; That format is valid, in that it compiles and seems to work just fine -- for a while. Later on in the manual we learn to allocate/release memory using the new and delete keywords. So, the same array would be: float * A = new float[10]; some code; delete[] A; Now, the question is: When does it become necessary to allocate memory for an array? I've seen code snipets of some fairly complicated algorithms, that make use of the simpler version of array declaration. But …

I have a soap call which returns an object which has a xml string. an example is shown below: <?xml version="1.0" encoding="utf-16"?> <LoginResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <StatusCode>1</StatusCode> <StatusMessage>Login Successful</StatusMessage> <AuthKey>b2365767-ae42-1a44a6436575</AuthKey> </LoginResponse> I would like it to convert it into an associative array which will be similar to: array( "LoginResponse"=>array( "StatusCode"=>1, "StatusMessage"=>"Login Successful" "AuthKey"=>"b2365767-ae42-1a44a6436575" ) ); Hope this makes sense I have tried simplexml_load_string() xml2array() nothing works

Hi, I have been creating a round robin. This is similar idea to speed dating except everyone has to talk to everyone. Whilst I have been able to create this, there is a lot of repetition in my code and I wondering if any of you have recommendations for removing some of that, particularly around the push and pops. The code below I tested within the js.do website. I will add the output below the code, so you get an idea of what this looks like. Any help will be appreciated. <p style="line-height: 18px; font-size: 18px; font-family: times;"> <br> Round …

I know that the main difference between an array and a list is that a list size changes dynamically as items are added or removed. Because of this, if we copy an array to a list does that mean that the list must have a static size of the array's capacity?

I have this assignment due this weekend and I was able to figure it out but for some reason the last part of my output is going up to 38 and I have no clue to way it would be doing that any thoughts to way. my output: output: PRINTING CONTENTS OF ARRAY ================================== ABCDEFGHIJKLMNOPQRSTUVWXYZ This is the title to your Program related to the alphabet. Select the number that coincides with the alphabet. For example, the number 7 should display the letter G. Enter a number between 1 and 26: 2 The number you selected: 2 The letter related …

Hey guys, i'm a bit of a new programmer taking a class.So in my code what im trying to do is to select three random numbers, and see if it matches with the numbers that the lottery throws out. The problem is where the 1st number and 3rd number selected randomly show up fine, but i have no idea on how to get the 2nd number to show up. I know my error is right here at lotteryDigit2 int lotteryDigit1 = lottery / 100; int lotteryDigit2 = lottery * 1; int lotteryDigit3 = lottery % 10; int guessDigit1 = guess …

Okay I hope my title is not confusing. I have two checkboxes names Delete[] and Update[] followed by a textbox named Name[]. When I tick checkbox Delete[] and click Submit, I ran a query to delete the data based on that Checkbox's value (which I have set to be the primary key of the record) and it worked fine. My problem started when I tried to do the same thing with my Update[] checkbox. After looking thru some forums I found the explanation I've been looking for: "Remember that in the POST data all of the textboxes will always be …

i made union to two mysql tables select cashid, sum(amt) as ramt, NULL AS pamt from receipt where cashid in ('17', '23') GROUP BY cashid union all select cashid, NULL AS ramt, sum(amt) as pamt from payment where cashid in ('17', '23') GROUP BY cashid and now i want to make calculations between them. like-- balance = ramt - pamt can anyone suggest me how can i do that? thanks in advance