637 Topics
| |
Someone help me creating a this program. Well, I need a program that makes a triangle out of asterisk but it doesnt use "for" loop it only requires "do-while" loop. Actually I tried making one but it doesn't look like a triangle instead it jsut display a line of asterisk. … | |
Hi, I've got a class in PHP with an array of objects in it. I need to loop through these objects and call 2 methods on them but I'm not sure of the best approach. When dealing with arrays, if you use foreach, you can't seem to update the actual … | |
Following up on a discussion on [this thread](http://www.daniweb.com/software-development/cpp/threads/470519/looping-using-recursion/), I did some tests on the performance of recursion vs. iteration, and some interesting things happened, so I thought I would share the results. I'm gonna structure this a bit like a lab-report, because that's really the best way to put it. … | |
I would like to convert Control objects wich are in my array to progress bar Objects if possible. I know that the reverse conversion can be done explicitly without a problem but this one seems tricky. If impossible then please suggest something else instead. TNX | |
Give that array I want to use the random string attached to the tab-title and tab content keys which are rEXMp and 3T2IV respectively , I want to use those to split the array into two arrays and getting rid of these characters in the new array and also add … | |
I have this array Array ( [0] => Array ( [post_category] => cat-1 ) [1] => Array ( [posts_count] => 33 ) [2] => Array ( [cells_num] => 1 ) [3] => Array ( [grid_num] => 0 ) [4] => Array ( [post_category] => cat-2 ) [5] => Array ( … | |
i am trying to get all the result from my databse table but this query is not working. <?php try { $pdo = new PDO('mysql:host=localhost;dbname=articles', 'Avik', ''); } catch (PDOException $e) { $output = 'Unable to connect to the database server.'; echo $output; exit(); } try { $sql = 'SELECT … | |
I am a newbie to python so exude the not so well constructed code.. I have two text files. The first one (WordFile1.txt) is " John Mary Joe alice William ….." The second (SearchText.txt) is "JOHN EGGS,24,BEEF,36,BACON,56,HAM,66 ALICE TOMATOES,16,HAM,35,BEANS,35" ……." If my response number is 2 I will get BEEF … | |
Hello, This if statement is always returning true and I cannot see why. Could you guys tell me why? menu = input("Choose what you would like to do:\n\n1. Work out how far you will travel with a set time and speed\n2. Work out the speed you will need to travel … | |
class Timerange{ public: Start_time start; End_time end; Timerange(string initstring){ //initstring xx:xx X, x:x //X->weekday string current=""; unsigned short mode=0; string timeA; string weekday; string timeB; for(unsigned short i = 0; i<initstring.length(); i++) { char c = initstring[i]; if (c==' '){ if (mode==0) timeA = current; else if (mode==1) weekday = … | |
I know I am probably over thinking this but I cannot seem to figure this out. I am trying to check if the value is null and if not to continue. /** * */ public Item getItem(String theItem) { Iterator iter = myItems.iterator(); while(iter.hasNext()) { Item anItem = (Item) iter.next(); … | |
// Expect to print values of arr[0] to arr[4] #include <iostream> #include <vector> using namespace std; int main() { vector<int *> ptrList; int arr[] = { 0, 10, 20, 30, 40 }; int * ptrArr = arr; for( int i=0; i< 5; i++ ) { ptrList.push_back( ptrArr+i ); } vector<int … | |
So I was asked to solve this question...however when i compile it, it doesn't work...could somebody tell me what's wrong and how to solve it (im guessing it's something to do with overloading since my lecturer was talking abt it just before this was given)? thanks a lot! #include <iostream> … | |
index.php coding <td><input type="text" name="slno[]" value="" size="2"></td> <td><input type="text" size="10" name="date[]" id="SelectedDate" onClick="GetDate(this);" readonly="readonly"/></td> <td><input size="24" type="text" name="particulars[]" value="" placeholder="Description"></td> <td><select name="noofnights[]" value="0"> <option value="empty"></option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option … | |
![3a451fbd93eb17f84f06c7ac648bdcab](/attachments/small/2/3a451fbd93eb17f84f06c7ac648bdcab.PNG "align-left") I need to create this program for class. I'm not looking for the answer. I'm simply confused on how to create a batch file where I input a number and it gives me an option. Would I use the IF command if so how would I do it. … | |
So as the title entails, my if else statemnt in php won't execute. i mean i would undrstand if the 'if' didn't execute but it didn't even read the else statement. so when i submit nothing happens. <?php session_start(); if(isset($_POST['jansave'])) { $basic = $_POST['basic']; $allowance = $_POST['allowance']; $bonus = $_POST['bonus']; … | |
How To Determine The Best Score? I am doing a lab regarding 'guess number game' Actually,the answer should be the random number,but I set the exact number to 88,because it is easy for me to test other requirement. I need to printf("Best Score so far [X]") How to make comparison … | |
Hi.here is a question I got for assignment.I am stuck in this for hours and couldnt com up with any logic.Any help will be highly appreciated.Thanks Depth-First-Search Q.No.1 The undirected unweighted graph with one selected vertex is given. Find the number of vertices in the connected component where the selected … | |
i wantto builda GPA in C# and want to a condtion which chek the value from user input. chek it if it is greater then 70 show A GRADE greater then 50 show B GRADE like and print it and also set is this char type value to switch and … | |
Hello! I'm having a rather difficult time because the concepts weren't very much explained in class for complex situations. I'm a bit entangled with the few if-else conditions I have... :( I've been trying hard to crack the case, but I think somebody really needs to see my work. Write … | |
Hey everyone, So, I need help understanding why I'm not able sort my code: here is my code (so far) for my selection sort. I have only written the iterative form of Selection Sort, but I know how to do it recursively as well (which is required for my homework). … | |
| Hey everyone, I'm doing a practice problem and I'm stuck. The question is "Given an array a of n numbers (say doubles), consider the problem of computing the average of the first i numbers, for i ranging from 0 to n-1. That is, compute the array b of length n, … |
Hey guys, I'm having difficulties with a problem. I iterate over an array of data with X rows And i have the positions of each row incremented, i would like that when i found an exception i shift all the position id's so after each exception the next ID has … | |
hi all, how to do multiplication matrix with iteration and stop iteration if value >= 5? $data = array( array(1,-0.52836), array(-0.52836,1,), ); for ($i=0;$i<count($data);$i++) { for ($j=0;$j<count($data[$i]);$j++) { $R2[$i][$j] = (($data[$i][0]*$data[0][$j])+($data[$i][1]*$data[1][$j])); } } echo "<pre>"; print_r($R2); echo "</pre>"; result: 1.279164732 -1.056721269 -1.056721269 1.318545629 how to do nested loop from process … | |
I need help in building a binary tree and putting integers in it. I need to write an add method in my MyArrayBinaryTree class (that extends ArrayBinaryTree) that allows me to place the element to be added in the very next available slot in the array. I also need to … | |
Hi Everyone... I have been digging around the web for the last two days trying to fix this problem myself, but have come to the realization that I need some help. I have a mysql query that selects all country names from my country db, (works as described) I then … | |
I have the following: in my **MODEL:** function get_advert() { $sql = "SELECT * FROM job_advert"; $advert = $this->db->query($sql)->result(); return $advert; } in my **CONTROLLER:** function get_detailed_list() { $job_advert = $this->ranking_model->get_advert(); echo '<pre>'; foreach ($job_advert as $j) { $job_id = $j->advert_id; $sql = "SELECT r.rank, a.advert_id AS job_id, a.job_title, d.firstname, … | |
am trying to show assigned variable for failed submission on a smarty form. array assigned as $arr = array($_POST[number]); $smarty->assign(number,$arr); and on tpl form, i added as below. {foreach from=$number item=no} <input name="number[]" type="text" value="{$no[{counter start=1}]}" /> {/foreach} am starting the counter from 1 because this is for dynamically added … | |
The below code displays correctly, I need an "IF" statement that prevents displaying rows with 0% in the percent column and I've tried several conditions. None are working. I only want to display rows that has at least 1% in the percent column. Here is the code: $result = mysql_query("SELECT … | |
Hi. Our homework is to use try...catch block in our calculator applet. I don't understand why the "catch" does not work. It will always go straight to the "finally". Here's the code: import java.applet.*; import java.awt.*; import java.awt.event.*; import java.awt.Label; import javax.swing.*; public class clsCalculator extends Applet implements ActionListener { … |
The End.