Hi Daniwebbers, can someone help me How to figure out the depth of a dynamic hash (hash of hashes) in perl. If it has consistent structure, we can traverse through while/foreach and find out the depth. Could anyone point me the right and best way to figure it out. my %hash1 = ( name => { first => "John", last => "branham", middle => "visa", }, address => { park => "cubbon", doorno => "4/6", other => { division => "division", city => "Cincinati", state => "Ohio", country => { cont => "NA", code => "USA", pin => "51123", }, …

Member Avatar
Member Avatar
+0 forum 3

a) Program code is often written using procedures. Give THREE advantages of using procedures in programming. b) Write an algorithm (pseudocode or flowchart) for a procedure to validate the input of a date in February in any year. The date should be input in the form ddmmyyyy e.g. 07021998 You will need to store each numeric part of the date separately and validate each part. Include a calculation to determine whether the year entered is a leap year and then check that day is within the allowed range – in a leap year there are 29 days in February otherwise …

Member Avatar
Member Avatar
-2 forum 6

Hi all !! I am new to Fortran. Please see the following code: program exp_realloc implicit none integer,allocatable,dimension(:,:):: array integer::i,j allocate(array(3,3)) write(*,*)size(array,1)," ",size(array,2) do i=1,3 do j=1,3 array(i,j)=i*j write(*,*)array(i,j) enddo write(*,*) enddo CALL func(array) end program exp_realloc subroutine func(array) integer,dimension(:,:),intent(in)::array integer::i,j write(*,*)"********* Inside subroutine **********" write(*,*)size(array,1)," ",size(array,2) write(*,*)array(1,1) write(*,*)array(1,2) write(*,*)array(2,1) do i=1,3 do j=1,3 write(*,*)array(i,j) enddo enddo end subroutine func The output is: 3 3 1 2 3 2 4 6 3 6 9 ********* Inside subroutine ********** 131097 1 Segmentation fault Two questions: 1. Why is the size of array not being printed correctly in the subroutine? 2. Why …

Member Avatar
+0 forum 0

using c++ and SubRoutine. Problem1: Design a function-oriented program that computes the total of the squares from 1 to n which n is supplied by a user. ex. 12345=1+4+9+16+25=55 Problem2:Design a function-oriented program that computes the factorial value of an input N by a user ..Display the computed factorial value on the screen.. thanks to all.. i hope u can help me..:)

Member Avatar
Member Avatar
+0 forum 6

This is the program I'm working on and I'm completely lost A Pythagorean triple is a set of numbers A, B, C such that A2 + B2 = C2. Write a subroutine that determines if 3 given numbers are a Pythagorean triple. The subroutine should print out an appropriate comment in each case. Test your solution with these sets; (3, 4, 5) and (7, 2, 9) This is what I have so far [CODE] import java.util.*; public class { public static void main(String[] args){ Scanner in = new Scanner(System.in); System.out.println("Enter a number."); int num1 = in.nextInt(); System.out.println("Enter a second number."); …

Member Avatar
Member Avatar
+0 forum 4

Hi All, Ok to make it clear from the start I'm a 'noob' with anything complex in computing. Currently I have been asked to look into using the Linpack Benchmark Software to run on computer workstations for Energy Star performance testing. I have spent the last few weeks combing the internet to get information about how this code works. All the help I have found is obviously only targeted toward people who already know about running subroutines and liner equations to judge performance of computers (formally only super computers), I don't have a clue what they are talking about. My …

Member Avatar
+0 forum 0

Hello, I'm new to this forum. Right now I'm developing a software based on Genetic Algorithms. I really have almost none experience, and I have a question. First of, this software is a prototype, a template. So the user can choose between a lot of choices (types of crossing and mutations). And I have many radio buttons for that. The question, like in the thread title is, can I give the name of a suroutine to a variable, so that sub executes instead of making a comparisson about which radio button is selecten, THEN execute the sub of that option. …

Member Avatar
Member Avatar
+0 forum 10

Another new coder here, and yes, I am a student. I am NOT asking for a solution, but I am asking for guidance to point me in the right direction. I am supposed to write a code that receives input from the terminal as to the temperature in Fahrenheit and the wind speed in meters per second. Then use 3 sub functions to 1) convert Fahrenheit to Celsius, 2) calculate windchill, and 3) convert from Celsius back to Fahrenheit. Then output the results if the temperature in C is less than or equal to 10 degrees. I have written the …

Member Avatar
Member Avatar
+0 forum 6

hello, i'm having trouble printing arrays to file. each time i run this code, i get only two results max. if the array has 2 genres, i get them but no languages. if the array has 1 genre i get it and only 1 language. if the array has more than 2 genres, i get only 2 and no languages. help will be greatly appreciated. sub WriteLineToFile{ my $MTitle = shift; my $MYear = shift; my $MDirectors = shift; my $MRatings = shift; my $MVoters = shift; my $MLength = shift; my $MAward = shift; my @MGenres = shift; my …

Member Avatar
Member Avatar
+0 forum 2

Hi All, I'm a student who really need help in this problem...what I need to do is to call/run/execute a subroutine using a varaible name from a subroutine. [code] Public Sub Main(ByVal subName as String) Call subName ' subName may be contain the value AAA or BBB End Sub '=========================== Public Sub AAA() 'do something for AAA End Sub '=========================== Public Sub BBB() 'do something for BBB End Sub [/code] I searched the web by no luck of trying what they have suggested or I have not found the right syntax...Please help...thanks in advance...

Member Avatar
Member Avatar
+0 forum 5

Hi everybody I have've been asked to do something but I can get only to a point and I am now stuck. Please help. I have written a Sub in VBA for Excel 2003 (see below) in which the top cell of a range (WorkRange) is initially set at Cells(1,2), where there is the first available price for a price series. Prices stream into the spreadsheet (streaming is provided independently from the Sub I wrote). For each new price that streams in the Sub calculates the max price (called: MaxVal) and a min value (MinVal) for the price series over …

Member Avatar
+0 forum 0

The End.