Hello Daniweb Community, Lately we have been experiencing slow internet, now the thing is. In the house we have **12 devices** connected, then from the router it goes out to the bungalow which has around **5-7 devices**. The router we have in the house is a TP-Link Archer D50 and in the bungalow is a TP-Link Archer C2 and we have **ADSL2+** (on the [Optus](http://www.optus.com.au) network). The maxium speed we were told we're getting is around **6-7Mbps/Download** and around **500-600Kbps/Upload**. The other problem we are having is, my sister can't even get a good connection on her PS4 (can't even …

Member Avatar
Member Avatar
+0 forum 5

Hello world! I am requiring some assistance with my C# program, where I am getting an error message for having a form where the user would enter in text into a text box. I am trying to detect if the user has pressed the Enter key, and on doing so would produce a message box with a message. However, I am trying to call the "KeyEventArgs" class which would allow me to detect the key press, but receive the following error message: **No overload for 'TextBox_KeyDown' matches delegate 'System.EventHandler'** Here is my code for the TextBox I am using: private …

Member Avatar
Member Avatar
+0 forum 2

can someone explain me how this operator work? i just need some hit to clearify my confusion on this... thanks

Member Avatar
Member Avatar
+0 forum 1

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> #include <vector> using namespace std; class Integer { public: int value; }; int main() { vector<Integer> v; for( int i=0; i<10; i++ ) { Integer x; x.value = i; v.push_back( x ); } vector<Integer>::iterator itr; for( itr=v.begin(); itr!=v.end(); itr+=2 ) cout << *itr << endl; return 0; }

Member Avatar
Member Avatar
+0 forum 2

I'm currently working on a project on VB.NET and I'm getting this error below. > Error 2 Overload resolution failed because no accessible 'New' is most specific for these arguments: 'Public Sub New(name As String, dataSourceValue As System.Collections.IEnumerable)': Not most specific. 'Public Sub New(name As String, dataSourceValue As System.Data.DataTable)': Not most specific. C:\Users\user\Desktop\POS\GUI\MainWindow.vb 279 17 POS below here is the code which actually the errors takes. Dim RDS As New Microsoft.Reporting.WinForms.ReportDataSource("POSDS_TotalProfitForAllTime", TmpDS.TotalProfitForAllTime) ' tell the report control to use the DS, and ' use the report template created by us. RV.LocalReport.DataSources.Add(RDS) RV.LocalReport.ReportEmbeddedResource = "POS.TotalProfitForAllTime.rdlc" RV.RefreshReport() Helping to solve this issue …

Member Avatar
Member Avatar
+0 forum 3

I'm making a class for boolean expressions, a simpler version of bool. I need three operators, one for AND, one for OR and one for NOT. I can easily make **+** for OR, by overloading, but how can i declare **.** for AND and **'** for NOT? Can i even do this? Thanks in advance P.S, i'm a beginner :)

Member Avatar
Member Avatar
+0 forum 3

I'm trying to make a program for my computer science class and it requires that I run output to the console as well as to a file. I'm looking for a way to intialize a string at the beginning of the program and pass the variable by reference to my functions. The functions will then append strings to the intialized variable. I need to be able to also set precision and justification for floating point variables that will be appended to the string. I am working with stringstream right now but every time I return the output string that I …

Member Avatar
Member Avatar
+0 forum 2

using System.Text; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { Cassandra myObject = new Cassandra(); string a ="söt"; myObject.hejsan(a); System.Console.WriteLine(a); Console.ReadLine(); } } class Cassandra { public string hejsan(string value) { value +="Cassnadra"; return value; } } } how come this wont work? all i get is "söt" as output when i should get "sötCassandra" thanks for answers :)

Member Avatar
Member Avatar
+0 forum 3

#include <iostream> #include <cmath> #include <string> #include <cstdlib> #include <cstring> using namespace std; char Outputing(char shifted_letter); int found_match; int searching_alphabet; int main() { const char ORIGINAL_alphabet[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; //maybe const isn't necesery char alphabet[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; cout << "This program encrypts messages using Ceaser Cipher\n"; cout << "\n---------------------------------------------------------"; cout << "\n---------------------------------------------------------"; cout << "\nEnter plaintext or enter ABC to use alphabet as plaintext:\n"; cin >> alphabet; if (stricmp(alphabet,"abc") == 0) //comperes alphabet and ABC { cout << "\nAlphabet selected as plaintext\n"; cout << "\n---------------------------------------------------------"; cout << "\nEnter shift for alphabet:\n"; int shift_for_alphabet; cin >> shift_for_alphabet; cout << "Alphabet set:"; for (int i=0;i<26;i++) { alphabet[i] …

Member Avatar
Member Avatar
+0 forum 1

Hey everyone, I'm working on an assignment and I'm having some trouble figuring out how to implement two operators. The program creates and implements a class to represent the Stack ADT using a singly-linked list. There is a driver program to test my implementation. I have everything implemented (except the top() method) correctly as far as I can tell, but I am really struggling to implement operator= and operator<<. Here is the description for the two: > operator=: The assignment operator should be properly overloaded. > operator<<: The output operator should be overloaded so that an entire Stack can be …

Member Avatar
Member Avatar
+1 forum 8

Give then following Class declaration: class Employee { public string Name { get; set; } public int Age { get; set; } public override bool Equals(object obj) { Console.WriteLine("In Equals(Object)"); if (obj is Employee) if (this.Name == (obj as Employee).Name && this.Age == (obj as Employee).Age) return true; else return false; else return false; } public bool Equals(Employee obj) { Console.WriteLine("In Equals(Employee)"); return this.Equals(obj as Object); } public override int GetHashCode() { return base.GetHashCode(); } } I'm trying to use Employee.Equals(Employee) but for some reason it doesn't work: private static void CompareObjects(Object a, Object b) { if (a.Equals(b as Employee)) …

Member Avatar
Member Avatar
+0 forum 2

I wrote two functions like that int absolute(int a) { return (a < 0) ? -a:a;} int absolute(int &a) { return (a = (a < 0) ? -a:a;} The two function have the same name and the same type, When I do like that: int main() { int a = -1; absolute(a); return a; } there is a error when I compile it, BUT it is not because of the two function but the calling absolute(a); I'm wondering how to call these two functions correctly, thx!

Member Avatar
Member Avatar
+0 forum 2

Hello, thought I'd ask before getting too deep into code to make sure I understand this properly. As described in the Gamma et. al. book the Visitor Pattern looks something like this: interface Visitor{ public void visitX(X x); public void visitY(Y y); public void visitZ(Z z); } interface Visited { public void visit(Visitor v); } class X implements Visited{ public void visit(Visitor v){ v.visitX(this); } } class Y implements Visited{ public void visit(Visitor v){ v.visitY(this); } } class Z implements Visited{ public void visit(Visitor v){ v.visitZ(this); } } //SOMEWHERE ELSE A CLASS public void doAlgorithm(Visitor visitor){ for(Visited v : datastructure){ …

Member Avatar
Member Avatar
+0 forum 5

Hi there, I need to overload istream in this way: it needs to get string, then it has to parse this string and get number - can be longer than long long, and then save this number in another string, which I will give to class method. So far so good, then I need to return fail bit if there is no digit or "-" at start, again thats alright. But problem comes when I need to return characters which are not digits after sucesfull digits scan back to istream - no idea how to do this.... Example: --------------------------- string …

Member Avatar
Member Avatar
+0 forum 2

So I have a matrix class that must run on a unix/linux server. The main is a test file that is provided by the instructor. When I compile my code in visual studio it works fine except for test 8 because I can't figure out how to return a print line for incompatible matrix multiplication. When I compile the code on the server it gives me error: no match for âoperator<<â in âstd::operator<< for both test 7 and 8. For test 7 I assume the compiler is having trouble identifying that there are 2 calls of transpose being called. Any …

Member Avatar
Member Avatar
+0 forum 2

Hi folks, I am learning operator overloading concept in c++, wrote sample program to test overloading of unary operator '!' and '-'. Code will work if i use them as friend function but not for member function. Can anybody tell where am i going wrong in function bool operator!(const co_ordi &a) and co_ordi operator-(const co_ordi &x); . Is that correct way to declare and define. I am getting following error Error: op_ovld_unary.cc:18: error: ‘bool co_ordi::operator!(const co_ordi&)’ must take ‘void’ op_ovld_unary.cc: In function ‘int main()’: op_ovld_unary.cc:45: error: no match for ‘operator!’ in ‘!a’ op_ovld_unary.cc:45: note: candidates are: operator!(bool) <built-in> op_ovld_unary.cc:50: error: …

Member Avatar
Member Avatar
+0 forum 2

I am inserting all of the words in the dictionary into the unordered_set STL. For the life of me, I cannot figure out how to override the default hash function for the unordered_set. Can someone please point me in the right direction? I cannot figure out the syntax. Thank you in advanced.

Member Avatar
Member Avatar
+0 forum 1

I am doing this assignment for my C++ class, and we have to instantiate 4 objects of the Student class, set the data members and then sort them according to the GPA variable. Ive whittled down the errors to just one, and I am stumped. Here is the error: error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'Student' (or there is no acceptable conversion) It happens in the for-loop at the end of main... anyone please help? [CODE]#include <iostream> #include <string> #include <algorithm> using namespace std; class Student { private: int stuID; string …

Member Avatar
Member Avatar
+0 forum 5

I attempted to overload the == operator for one of my classes, I even copied a previous implementation of it, but now that I am using pointers it refuses to function properly here is the relevant code (there is a lot so I will provide more if need be) [CODE]#ifndef __MESSAGE_H #define __MESSAGE_H #include <iostream> using namespace std; class Message { public: Message(int idnum, char* inmsg); ~Message(); Message(const Message* &m); Message & operator= ( const Message & assignFrom ); bool operator== ( const Message* & m ) const; bool operator!= ( const Message* & m ) const; friend istream & …

Member Avatar
Member Avatar
+0 forum 4

Error C2662: 'Event::GetTime' : cannot convert 'this' pointer from 'const Event' to 'Event &'. This is my code: [CODE] #include <iostream> #include <queue> #ifndef Person_h #define Person_h #include "Person.h" #endif using namespace std; enum EventName { _SendMessageToUserInterface, _SetPNOld, _IntroduceInfection }; class Event{ int time; EventName name; Person person; public: Event(int t, EventName n, Person p) { time = t; name = n; person = p; } int GetTime() { return time; } Person GetPerson() { return person; } EventName GetName() { return name; } bool operator<(const Event& e) const { return time < e.GetTime(); } bool operator==(const Event& e) const …

Member Avatar
Member Avatar
+0 forum 1

hi in my text book i have this problem. how to program this [ICODE] Define a class Quadratic_int that stores the coefficients of a quadratic polynomial in a dynamically allocated array of integers. Supply the "big three" memory management functions. Use this class to demonstrate (a) the difference between initialization Quadratic_int s; Quadratic_int t = s; and assignment operation Quadratic_int s; Quadratic_int t; s = t; (b) the fact that all constructed objects are automatically destroyed (c) the fact that the copy constructor is invoked if an object is passed by value to a function (d) the fact that the …

Member Avatar
Member Avatar
-2 forum 5

Hello forum. I cant figure out how to overload the '+' operator or maybe theres another error? Im posting from phone so excuse the slopyness. Thanks! [CODE]#include <iostream> #include <string.h> #include <ctype.h> using namespace std; class Ferma { public: static int nr_rate; static int nr_gaini; static int nr_porci; static int nr_vaci; virtual void afisare() { cout<<"Ferma:\n"; } private: int id; string animal; }; int Ferma::nr_rate=0; int Ferma::nr_gaini=0; int Ferma::nr_vaci=0; int Ferma::nr_porci=0; class Pasari:public Ferma { public: Pasari(string s):animal(s) { if(s=="rata") { ++nr_rate; id=nr_rate; cout<<"Tocmai am creeat rata"<<id<<"!"<<endl; } else if(s=="gaina") { ++nr_gaini; id=nr_gaini; cout<<"Tocmai am creeat gaina"<<id<<"!"<<endl; } } void …

Member Avatar
Member Avatar
+0 forum 3

Hey, so i've looked around online for a bit, and after finding similar, but not exact (as in it doesn't help me), i'm gonna post my problem here :P. I'm working on a class to handle Complex numbers. This is going to require a lot of operator overloads and the sort to handle the different operations i need to test. Well one of the things that i need to do is be able to use the << and >> operators to input/output data so things are read/shown properly. My header file is below: [CODE] // ******************************************************** // Complex.h // // …

Member Avatar
Member Avatar
+0 forum 4

Hey all, I'm writing a program that is an address book using an AVL Node structure (which was provided). I defined the [I]contact[/I] class as the ItemType of the data to be inserted in each node. Initially I encountered a Segmentation fault that occured during the assignment from the AVLClass object returned from Read_DB() to the AVLClass object AVLTreeContacts. AVLClass has an overloaded assignment operator that copies all the nodes of the tree. // Original screen output at runtime before writing overloaded = operator for contact class Database successfully read DEBUG: AVLClass overloaded = operator called DEBUG: AVLClass CopyTree called …

Member Avatar
Member Avatar
+0 forum 4

Hello, I have a problem which goes like this. I need to be able to design a simple class, which i have done, and it must represent any numeric value, which includes a decimal and negative value. So i need to overload the operators, because the '%' will make an error if introduced a double. Type in explanations as simple as possible. Someone help!! [CODE]//**************************************************** // This Program Demonstrates a simple class structure //**************************************************** #include <iostream> using namespace std; class game { private: int number_one; int number_two; public: void set_numbers(); int validation(); void addition(); void subtraction(); void multiplication(); void division(); …

Member Avatar
Member Avatar
+0 forum 2

[CODE] #ifndef POLYNOMIAL_H #define POLYNOMIAL_H class Polynomial { public: Polynomial(); Polynomial(int ,int []); ~Polynomial(); const Polynomial operator+(Polynomial& p) const;// addition const Polynomial operator- (Polynomial& p ) const; // subtraction int getExponent(); //void setExponent(); void setCoefficient(); int getCoefficient(); void printPolynomial(); private: int exponent; // exponent int coefficient[ 10 ]; // coefficients array }; #endif //end of class definition [/CODE] [CODE] //Polynomial.cpp #include "Polynomial.h" #include <iostream> using std::cout; using std::endl; using std::cin; Polynomial::Polynomial() //default constructor { exponent = 0; coefficient[10] = 0; } Polynomial::Polynomial(int x,int c[]) //constructor { if(x>=0 && x<10){ exponent=x; for(int i=0;i<=exponent;i++) coefficient[i]=c[i]; for(int i=exponent+1;i<10;i++) coefficient[i]=0; } else { exponent=0; …

Member Avatar
Member Avatar
+0 forum 2

Hey, I keep getting this error, but from its description, I can't really tell how to fix it besides from what I've already tried, so any explanation would be great. The error I get is: clientrectlib.cpp(32) : error C2664: 'calcMinMaxValue' :cannot convert parameter 1 from 'overloaded-function' to 'float &'. The code is the following: (This is clientrectlib.cpp) [CODE]#include <iostream> #include "Rect.h" using namespace std; int main() { cout << "Client to test the Rect library\n"; cout << "Creating some variable of type Rect ...." << endl; RectStruct *rect01 = new RectStruct; RectStruct *rect02 = new RectStruct; RectStruct rect03; cout << …

Member Avatar
Member Avatar
+0 forum 5

Hi there, I'm new to the forum so please be kind :) I've created a class called node that has a standard constructor and an overload that uses an int as an argument. [code=c]class node { public: node(void); node(int inputs); ... };[/code] I can create an dynamic array of nodes with [code=c]node *nodes; node = new nodes[number];[/code] which works very nicely. But now I want to setup the nodes using the overloaded constructor. I tried [code=c]node = new nodes(width)[number];[/code] but that just created a whole load of errors. I realise I could make another function in the node class that …

Member Avatar
Member Avatar
+0 forum 7

Hi experts! I have the following code which I use for dynamically creating objects in one module (executable or shared object (.so or .dll)) and be able to delete it from any other module while enforcing the call to the delete operator in the original module where the object was created (such that the same Heap is used for sure). This is essential for being able to easily use the shared_ptr across the modules while not having to care about in what module the object ends up being deleted by the depletion of the shared_ptr reference count. However, I am …

Member Avatar
+1 forum 0

I'm a little new to C++ templating, and I'm having trouble understanding this behaviour. Basically, I have a templated class, and I want to define the = operator between the class and the same class with any template parameter. The problem is that the overloaded version of the = operator is only being used when the two instances of the class have distinct template parameters. It's not being called when the same class types are being used. I've isolated the problem as much as I can in the following code: [CODE]include <iostream> using namespace std; template <class T> class A …

Member Avatar
Member Avatar
+0 forum 1

The End.