637 Topics
| |
the loop runs infinte for the second ittiration //attempt two to make the student data base the other way // this program runs onlu once and does not hav any data base once u exit #include<iostream> #include<conio.h> using std::cout; using std::endl; using std::cin; int count=0; class student { double m_roll[100],m_class[100]; … | |
This code works fine but it would be too long if the score is 50 or over. Is there any way to make it shorter and quicker? I tried to use for loop statement but it didn't work well. background(backgroundChange); if (score >= 5 && score < 10) backgroundChange-=0.8; else … | |
Hi everybody, i have problem in my php code (it just showing nothing....means no error no results).......can anybody tell me what is wrong with this code.....i'm new to PHP........here is my code <?php try { $config=array( 'DB_USERNAME'=>'root', 'DB_PASSWORD'=>'' ); $conn=new PDO('mysql:host=localhost;dbname=scc',$config['DB_USERNAME'],$config['DB_PASSWORD']); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo rand_id(); } catch(Exception $e) { echo … | |
Hey everyone! Happy New Year! I am trying to hone my programming skills by writing simple applications. I created a very simple currency converter program (hard-coded exchange rates....so nothing special). I first created it as a console app, and then in WPF. Anyway, I ran into an issue with the … | |
**Does the code** int value = 5; if(value==5) System.out.println("value is 5"); if(value==6) System.out.println("value is 6"); **actually compute faster than** int value = 5; if(value==5) System.out.println("value is 5"); else if(value==6) System.out.println("value is 6"); **?** I would assume that it *is* faster, based on its name and all, but is that actually … | |
So in my classes I've taken I was told by the teacher "case statements and if-else statements are the same things essentionally" so why learn both? and so I was not taught about cases. Besides the fact I should learn it anyway incase I need it for someone elses code, … | |
As you know how avl should be balanced after deletion of a node, I'll get to point. For starting, Im considering deleteing a node with no children. For Example a Tree: 10 / \ 5 17 / \ / \ 2 9 12 20 \ \ 3 50 Lets say … | |
I am trying to turn off a block in drupal using existing code. <?php $node = node_load(arg(1)); $type = $node->type; if(substr($_SERVER["REQUEST_URI"], 0, 13) == '/our-people') { return TRUE; } else { return in_array($type,array('3_column_interior_page', '3_column_faculty_bio_page')); } ?> I wanted to add a page that will not show the block... <?php $node … | |
hey guys , I don't understand why the outPUT is that for the code below.. can someone please explin me how it works. Thank you. class example{ public static void main (String[]args){ int i = 1,j; while (i<=3){ j=i; while(j<=4){ System.out.println(j+" "+i); j=j+2; } i=i+1; } } } HERE IS … | |
| I want to check if value is already exists in database with php. But this value can be as for example "John" or "JOHN" or "JOhn" or ... e.t.c how to check for all conditions? |
Alright guys, I've been looking at this on google and I can't seem to find an answer. Any help is definitely appreciated! Here is the code, then I will explain my problem. void printMenu() { cout<<"||============================||"<<endl; cout<<"||=========Main Menu==========||"<<endl; cout<<"||===1.Begin DNA Creation"; cout<<"||===2.Load the Files"; if(!dna1[].strand1){ cout<<"<0>";} else{ cout<<"<"<<sizeof(dna1.strand1)<<">";} cout<<endl; cout<<"=========||"<<endl; … | |
I am getting the error message "Invalid argument supplied for foreach()". I can't see to figure out what. Below is my query. Is there something I'm missing? Thanks public function editRole($id) { $q = $this->_db->query("SELECT * FROM `" . TP . "roles` WHERE `ID` = '" . floatval($id) . "' … | |
I am trying to switch the below code to sort in descending order rather than ascending. It works when counting upwards, but nothing I try helps with getting it to count starting with the largest number and count downward. public static void insertionSort(Comparable[] list) { for (int index = 1; … | |
Hi guys, I'm still new to .NET and your answers to my questions have been so helpful. I have another question yet again, however. This time my question has to do with sql server and handling it with code behind. I am creating a stored procedure which is supposed to … | |
Hey guys, I've tried writing code to reverse my sentence, but I keep getting an error in my for loop saying "Expected Expression". Also, should the asterisk go after the "modify" in my code? I'm not sure how pointers are exactly supposed to work and I haven't been given any … | |
//Bubble.h #include <iostream> #include <fstream> #include <cstdlib> using namespace std; struct nodeType { int info; nodeType *link; }; class Bubble { public: Bubble(); //constructor //deconstructor //copy constructor //operator= (overloading the = operator) friend istream & operator>> (istream &infile, Bubble & mylist); friend ostream & operator<< (ostream &outfile, const Bubble & … | |
So Im creating Simple Binary Tree, not BST. Im having problem in deletewith 2 child. Method for deletion is DELETE WITH COPYING. After deleteing, when I traverse the tree, it shows run time error, **Unhandled exception at 0x008B5853 in binarytree.exe: 0xC0000005: Access violation reading location 0xFEEEFEEE.** Here is the function: … | |
My name is Leonard E. Norwood Jr. I'm just practicing a simple bubblesort program but this time using classes and pointers with operators >> and << and also an overloaded operator =. I'm merely trying to sort a list of numbers from lowest to highest. And the purpose of the … | |
Hello again.I recently have been doing a assignment which asks us to write a function to check whether a tree is perfectly balanced.I know the concept of Perfectly balanced tree but I just cant make out how to write this function.Any help in right direction will be highly welcome. | |
Hi everyone. I've been struggling with a quicksort implementation here. I think - scratch that - I know i'm overrunning an array (erm, vector) based on how it explodes, but I honestly can't see it and I have no debugger. I slept on it but fresh eyes didn't get me … | |
Hey guys i am in trouble about BST Tree exercise.. i need to create an array that can take number of elements user want and the user has to enter integers but the program need to get this number in one line ... Here is code that i already wrote … | |
Hi there, am I doing something wrong with the if-statement? it either doesn't evaluate the conditions I've got in there or throw an error. $('button').click(function(){ var button = $($(this)).text(); console.log(button); // this logs the value of button as night or day depending on the button I click if(button == 'day'){ … | |
I think this simple example might ask the question a lot more clearly. I have an input file with multiple products. There are different types of product (2 types with 2 product IDs is fine enough for this example), but the input will have many more. I only want to … | |
I am creating a method to multiply 2 polynomial expressions together such that: `3x^5 * 2x^3 = 6x^8` -> Where the coefficients are multiplied and the exponents are added together. My test case for this would look something like the following @Test public void times01() throws TError { assertEquals(Term.Zero, Term.Zero.times(Term.Zero)); … | |
Hi, Very fast question guys, since tomorrow is my quiz and I have to sleep now. I stompled upon an old question asking to ** remove the root of the AVL Tree** . I never tried that before, after a very fast search, I found this PDF File https://www.student.cs.uwaterloo.ca/~cs240/s10/handouts/tree-examples.pdf ** … | |
Could you help me solve the problem The code bellow locate the image path just in "image1" Something like this id image1 image2 image3 image4 image5 image6 1 pic1 2 pic2 but I need to get something like this id image1 image2 image3 image4 image5 image6 1 pic1 pic2 pic2 … | |
I'm trying to switch "M" to "Mr." and "F" to "Ms." when the last name is selected in the listbox. When I clicked on the first name it worked, but when I clicked on anyother name, I got this error message: --Additional information: Index was outside the bounds of the … | |
I can't seem to wrap my head around this. I'll need a seasoned programmer to push in the right direction. I have a listView with 7 sub items. What I'm looking to do is populate a table in an .mdb file with the data. The listView box is almost the … | |
Hi, recently i started taking lessons on c programming and my first assignment was to make programm which would name all the perfect multiperfect or superperfect numbers within a set (whose limits will be given as #define constants) and their percentage. Anyway apart from any logic errors (which i would … | |
| Hi guys, so im required to write a programme that will make a table, along with the values and all and im also required to mark "X" at the minimum value of total time A+B (exactly beside the minimum value in the table). I tried using if statement but it … |
The End.