Good morning everyone, The library will be home, 0800 till 2100. I've been working on trying my loops in my hailstone sequence into recursions. It seem recursion can easrier to do, instead of creating loops. I say seem, because now I have come to halt on my progress. The halt is in the form of my sequence_Max function: /* //sequence_Max(int n) //Returns the largest value in the //hailstone sequence starting at 'n'. */ int sequence_Max(int n) { //Variable Declaration. int max = n, temp = n; while (temp > 1) { temp = next(temp); if(temp > max) { max = …

Member Avatar
Member Avatar
+0 forum 29

Hi All, In below code when class a object is assigned to class b by returning object through factory method i observed assignment is not happening properly and after assignment still class b's object points to NULL object only. *cobj=rhs;//it gives NULL object However below statement works perfectly when b object cobj is directly assigned inside assignment operator . cobj=a::fact("a11")//it works fine can anybody let me know what is wrong with assignment approach ? I know there are other way as well (setter method) but i am curious to know in this circumstances how assignment is taken care. #include <iostream> …

Member Avatar
Member Avatar
+0 forum 4

Hi All, After compiling below code , I am getting below error. error: cannot convert a* to b* in assignment. it seems to be assignment doesn't work with pointers . Can anybody throw some light on this? i tried to use unique_ptr by transfering the ownership from a to b but it doesn't work. #include <iostream> #include <memory> using namespace std; class b ; class a { int a1 ; b *p; public: a(int x=0):a1(x){} void fun1() {cout<<a1;} }; class b { private: a *p; public: b (int x=0) { p= new a(x); //p1=new a(x); } b ( const b …

Member Avatar
Member Avatar
+0 forum 8

Hi Guys, In below code you can see that i am able to execute the functionality of class a , inside the class b through composition and object of b can be used to call the methods declared inside the a class. #include <iostream> using namespace std; class a { int a1; public: a( int _a1=0):a1(_a1) { } void showname() { cout<<"class name a with value ="<<a1<<endl; } }; class b { public: b(a* cobj) : cobj(cobj) { cout<<"object initialization\n"; } void display() { cobj->showname(); } ~b () { cout<<"deleted the object of a"<<endl; delete cobj; } private: a *cobj; …

Member Avatar
Member Avatar
+0 forum 14

One of my students make me a question (which answer i know) but I think could be instructive to formulate the same question here so many people can learn about it. The question is: How to implement a copy assignment into a Derived class? Consider the following class A: class A { public: A(int i1_) : i1{i1_} {} A(const A& a) : i1{a.i1} {} // Copy constructor A& operator=(const A& a) // Copy assignment { i1=a.i1; return *this; } private: int i1; }; and you want to implement a derived class B: class B: public A { public: B(int i1_, …

Member Avatar
Member Avatar
+0 forum 8

Hello Everyone, Actually I have a good command on html, css, css3... Now I'm turning towards jquery and watching video tutorials. So, I want to get assignment on daily basis of Jquery. Is there any person who can give me the assignment, so that I can improve my jquery....

Member Avatar
Member Avatar
+0 forum 3

To continue[ my quiz series](http://www.daniweb.com/search/query/0?q=%22quiz+of+the%22+pytony#gsc.tab=0&gsc.q=%22quiz%20of%20the%22%20pytony&gsc.page=1), explain what happens with this code (how you would name this action and is there other way to get same result), why, and what is actually the value of `a` at end. a = ['a', 'b','e'] a[2:2] = ['c', 'd']

Member Avatar
Member Avatar
+0 forum 3

Hi, I have an assignment. I need to write code in logic programming language SWI-Prolog. Its very hard and I am going to appreciate if you help me :D. This is the assigment: Print 2D array size of (width x height) in spiral order. More explanation and example: You have input, width and height that are integers. With this input program needs to print a matrix "spiral" of numbers, from 1 to (height x width). Height is size of column in "spiral" matrix Width is size of row in "spiral" matrix This is just an example: spiralmatrix(w,h). /*w - width, …

Member Avatar
Member Avatar
+0 forum 2

Hi, While executing below code i am getting error like "memory clobbered before allocated block" and due to this assignment is not happening. could you let me know what can be reason for the same. I do understand it is not good to use raw pointer but in current scenario i don't have other than any option. #include<iostream.h> using namespace std; class Derived1 { int *m_p; public: Derived1 (int *m_p):m_p(m_p){}; Derived1& operator =( const Derived1 &obj); void show()const {cout<<"integer address="<<(void*)m_p<<endl; cout<<"integer="<<*m_p<<endl; } ~Derived1(){ delete m_p; } }; Derived1& Derived1::operator=(const Derived1 &obj) { if (this!=&obj) { cout<<"We are Here"; int *orig …

Member Avatar
Member Avatar
+0 forum 4

plz community members, am a new student in programing and i would wish you people help me write a programme : that accepts marks in five subjects for a student and stores them in an array.The programme then computes the avarage and grades of the student using the scheme below. A:80-100 B:70-79 C:60-69 D:50-59 E:<50

Member Avatar
Member Avatar
+0 forum 1

HI GUYS I HAVE 2 WEEKS INTO THIS SUBJECT C++ AND OUR LECTURER HAS SINCE GIVEN US AN ASSIGNMENT.ONE OF THE QUESTION STATES; CONVERT THE FOLLOWING ALGEBRAIC EXPRESSIONS TO C++ a) M= A+B+C+D+E/5 B)Y=MX+B C)Z=PR+Q+W/X-Y D)Y=X(SQUARED)/B(SQUARED) E)Y=AX(SQUARED)+BX+C F)3(a+17) g)x+2=28 h) 50 n+5 =10 i)7x(squared)+4x-10 j)A IS NOT EQUAL TO B

Member Avatar
Member Avatar
+0 forum 5

write a C++ program which inputs litre consumption given in miles/gallon and which translates these figures into the litres/kilometre format which is more common in Europe.Use the following conversion factors: 1 mile=1.609km and 1 gallon= 3.785litres

Member Avatar
Member Avatar
+0 forum 5

Hi. So I have an assignment wherein I have to calculate the highest, lowest and average of the bowling scores that is entered. How do I do it? I am so confused!

Member Avatar
Member Avatar
+0 forum 1

hi everybody this is my code below that i did so far for my assignment i made a smiley but ,it s everywhere in my code ,and it s not so perfect i think i need only 1 and big smiley in my pattern i think i am missing something in my for loop Anybody help, i will preciate Thank you .. #include "graphics.h" #include <math.h> int main() { int pattern[16][16] = { { 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,}, { 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,}, { 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,}, { 15,15,15,0,0,0,15,15,15,15,0,0,0,15,15,15,}, { 15,15,15,0,0,0,15,15,15,15,0,0,0,15,15,15,}, { 15,15,15,0,0,0,15,15,15,15,0,0,0,15,15,15,}, { 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,}, { 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,}, { 15,15,15,15,0,15,15,15, 0,15,15,15,15,15,15,15,}, { 15,15,15,15,0,0,15,15,0,0,15,15,15,15,15,15,}, { 15,15,15,15,0,0,0,0,0,0,0,15,15,15,15,15,}, { 15,15,15,15,0,0,0,0,0,0,0,15,15,15,15,15,}, { 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,}, …

Member Avatar
Member Avatar
+0 forum 4

Are there any just 10 Mbps Switches? I'm doing a assignment for school and we need to use a 10 Mbps switch But i dont know any. If there are can I have the names.

Member Avatar
Member Avatar
+0 forum 3

Programming Python 3rd Edition by Mark Lutz has example code (below) where a variable seems to be assigned with options ("or") but what the criteria for selecting the options is not clear. The explanation is almost non-existent but I think this is to do with feeding in a variable number of command line argments Can someone clarify the use of "or" in line: **self.verbose = self.getopt('-v') or self.getenv('VERBOSE') ** Thank you import sys, os, traceback class AppError(Exception): pass # errors raised here class App: # the root class def __init__(self, name=None): self.name = name or self.__class__.__name__ # the lowest class …

Member Avatar
Member Avatar
+0 forum 6

I am trying to search for a shell script if it is running and then assigning the count to a variable. Let the script be ScriptXYZ.sh. I wrote: proc_count=$(/bin/ps -ef | grep ScriptXYZ.sh | grep -v grep | wc -l) The problem that I am facing is that even when there is no instance of the ScriptXYZ.sh running I get a proc_count = 2. I tried running the command directly in the terminal and it yielded zero. But this variable always fetches value 2. I tried to put the quotes around it. proc_count="$(/bin/ps -ef | grep ScriptXYZ.sh | grep -v …

Member Avatar
Member Avatar
+0 forum 3

I NEED HELP! (please and thank you). I have an assignmet for extra points. I'm lost. Out profesor is not explaining anything and the assignments are NOT what we covered so far (which isn't much). I could use any help I can get. I've been trying to google it and how to use functions and i'm helpless. I heard a lot about this forum, so here I am! The assignment says: In recent years, college tuition has risen at a national average annual rate of 15%. a) Write the function definition of this function heather: def Tuition(current, thisYear, targetYear): This …

Member Avatar
Member Avatar
+0 forum 8

1. Please write 1 simple C++ program to calculate any number and the operation you should do is: -add, minus,divide,multiply 2. Please write a program C++ that can accept user input ( ex.student name, address, date of birth etc..) in Character Data Type. Once, the input has been entered, it will be display as / an output when the program run. 3. Please write 1 prgram using C++ to calculate the area of Trapezoid. Please use the CONSTANT. 4. Please state how to declare a variable by using character and numbers date type. 5. What the main purpose by using …

Member Avatar
Member Avatar
+0 forum 2

Hello This is one of those stupid questions but you gotta ask to be sure What is var h=0; h += 5; var l=0; l -= 5; Is it the same as: var h=0; h = h+ 5; var l=0; l = l- 5; Thanks and sorry for the stupidity

Member Avatar
Member Avatar
+0 forum 13

I need help with 2d arrays i've posted the problem here [Click Here](http://www.java-forums.org/new-java/71879-please-help-me-im-almost-there.html) (i've posted the problem on java-forums as well) Could someone please tell me what i'm doing wrong or how i could fix this? Thanks!

Member Avatar
Member Avatar
+0 forum 3

Im having this weird runtime error whenever I attempt to copy a specific member of an array block. I get this from the output: ASSERT failure in QHash: "Iterating beyond end()", file tools/qhash.cpp, line 293 Invalid parameter passed to C runtime function. Invalid parameter passed to C runtime function. I redid the code so i could specify what seems to be causing the problem. //"Heading" is a QString someClass *pointerFromArrayBlock = &theArray[10]; cout<< pointerFromArrayBlock->Heading() <<endl;//runs fine QString test = pointerFromArrayBlock->Heading();//causes crash someClass *pointer_NOT_FromArray = new someClass(/*some parameters*/); cout<< value_NOT_FromArray->Heading() <<endl;//runs fine QString test2 = value_NOT_FromArray->Heading(); //runs fine

Member Avatar
Member Avatar
+0 forum 8

int [] ia1 = {1,2,3}; int [][] ia2; Object o = ia1; ia2 = new int [3][3]; ia2[0] = (int[])o; ia2[0][0] = (int[])o; Answer is "Compilation fails in last line" Explanation: Arrays are objects, and that each array dimension is a separate type. So, for instance, ia2 is of type "two dimensional int array", which is a different type than ia1. Last line attempts to assign a one-dimensional array into an int. Doubt: Isn't the second last line also trying to assign a one dimensional int array to a two dimensional one? I'm terribly confused in the last two lines …

Member Avatar
Member Avatar
+0 forum 2

Hi. I am a very beginner at Java. I am taking an online course on Java and I'm stuck on an assignment. Anyone who is good with Java, can you please take a look at my code? This assignment was due yesterday but I couldn't finish it. It is very unfinished, but I'm not sure how to continue because I'm still not familiar with the concept of object oriented programming (getters, setters, constructors, etc). Could anyone please explain more object oriented programming to me? Also what do getters and setters do? And can you give me an example of using …

Member Avatar
Member Avatar
+0 forum 4

I need help with creating the room class and dungeon class, i keep going back and forth and now I am just confusing myself. DUNGEON ADVENTURE PROGRAM PURPOSE: The purpose of this is assignment is for you to practice working with two dimensional arrays as well as to continue developing your skills at working with multiple classes. The code that you write for this assignment will be used in Assignment 3. It is imperative you get the program working, since Assignment 3 directly depends on it. For this assignment, you will design 4 classes. The details of the classes are …

Member Avatar
Member Avatar
+0 forum 3

I was wondering, is it possible to do something like the following? The given code obviously doesn't work. [CODE] l = 5 (l == 5)*(k = 7) #Returns error message.[/CODE] The reason is, I'd rather avoid doing something like the following for the project I'm currently working on. [CODE] if stmt1 == True or stmt2 == True: if stmt1 == True: k = 7 if k == 7: # Evaluate suite else: # Evaluate different suite [/CODE]

Member Avatar
Member Avatar
+0 forum 4

I'm making a maze game for a project in school, and as such i need to create boundaries for the game. not only for the outer walls but also inner ones of different and sometimes not perfect squares. I was just wondering how i should go about doing this? Is there a way for the program to realize what colour it's about to go onto, then make plans accordingly? like the colour white is okay to walk on, but black isn't [CODE]import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Dimension; import java.util.Random; import java.awt.geom.Line2D; import java.awt.geom.Ellipse2D; import java.awt.geom.Rectangle2D; import java.awt.GridLayout; import …

Member Avatar
Member Avatar
+0 forum 1

Hello! I've been looking into using listbox as for part of my assignment and i was wondering if you guys could help point me in the right direction of what to look into next. I know how to make a list box, add objects to the list, modify, and delete from the list. However what i want to do is to have a list box (or something else this is the part i'm not sure on) where you add a task i.e. do assignment, and then from that double click, or go onto it some more, where i can then …

Member Avatar
Member Avatar
+0 forum 4

Hello, I am doing a simple calculator program. I have a combo box and assigned numerical values to a string variable under each case number using the same variable name. My problem is I don't know how to assign that value. When I use the current code, it pulls the value of the case select number rather than the assigned value. I suspect the problem is my string variable assignment. Any help would be greatly appreciated. Here is some of the code... [code]Dim strSelection As String Dim decSelection As Decimal 'Assign value to variables strSelection = cboConversionType.SelectedIndex.ToString() 'Check to make …

Member Avatar
Member Avatar
+0 forum 6

Hi everyone, Im new to the community and was just wondering if I could get some help :) I have an assignment where i have to create a program for a shipping company and I was wondering if someone could help me with the coding to assign the sum of a value to my array. In line 75 after it says Freight Id is: I want to be able to assign the result of case 1 to any number in int freightId and then display it after. [CODE]#include <iostream> #include <iomanip> #include <ctime> #include <cstdlib> using namespace std; double shipcharge(double …

Member Avatar
Member Avatar
+0 forum 5

The End.