429 Posted Topics

Member Avatar for fidan

I don't know of any tools but it seems from the error that it cannot find the definition of some function called NodeFactory::CreateNode . Can you think of any reason why that could be?

Member Avatar for fidan
0
628
Member Avatar for devster123456

[code=c++] #include <cmath> #include <iostream> using namespace std; int main() { int num, countA, countB; cout << "Please enter a positive maxiumum integer value you wish to find divisors: \n"; cin >> num; if (num <= 0) { cout << "The input entered was invalid. Please input a positive whole …

Member Avatar for Agni
0
452
Member Avatar for Violet_82

cin leaves the newline character in the stream, which gets consumed by cin.get() and it doesn't help. put a cin.ignore after the last cin and then cin.get() as pointed above. For a more thorough explanation check this [URL="http://www.daniweb.com/forums/thread90228.html"]http://www.daniweb.com/forums/thread90228.html[/URL]

Member Avatar for Violet_82
0
139
Member Avatar for WargRider

If you mean something like the Java 'Object' class which is the superclass for everything, then no, C++ doesn't provide it per se, but you can always implement it by having a common base class which every class inherits and which has the properties of being a superclass to every …

Member Avatar for Narue
0
4K
Member Avatar for Agni

Hi, We have created an ER diagram for the below mentioned scenario. This is the first time we're doing this, some comments would be useful Problem statement: A website which allows students to sign-in and register for different courses. Students can then create question sets for registered courses. Each question …

0
64
Member Avatar for deetlej1

Have you seen the reference on assert function? It says that it needs an expression, and if the value of the expression is '0' , it terminates the program. Now since what you have is just 2 ints that represent the day and the month, it is upto you to …

Member Avatar for deetlej1
0
161
Member Avatar for elexender

For strcat to work the destination should be large enough to hold the concatenated output. temp points to a memory location that is big enough to hold the filename and nothing more.

Member Avatar for elexender
0
138
Member Avatar for Ana_Developer

You can find a lot of material on coding up BFS on the net. What language are you going to code it in? If you have tried something, post in the relevant forum and you would get a lot more specific help. And try to explain it better.

Member Avatar for Agni
0
63
Member Avatar for CollDet

You ought to know at compile time if a class is updatable or not, because they will derive from the IUpdatable. So just add a field in Object class, isUpdatable, and set it appropriately for classes that derive from IUpdatable and classes that don't.

Member Avatar for Agni
0
102
Member Avatar for nucoder

[Quote] 1. Array Totaler: Given an integer array of size 50 (Filled with numbers read in from a file called “numbers.txt”, which is assumed to have 50 integer values), do the following: A) display the array to the screen (use 5 rows of 10 numbers each), B) ask the user …

Member Avatar for nucoder
0
170
Member Avatar for suncica2222

[QUOTE=suncica2222;1121242]I use MS VC++6 and when I type code I have problem...let's say I have 123456789 typed and I place cursor between 4 and 5 and than type "something" I get 1234something and not 1234something56789 so it deletes and wont shift right :S also enter doesnt brake new line,space,backspace.... I …

Member Avatar for suncica2222
0
89
Member Avatar for 28daniela28

[QUOTE=28daniela28;1110706]I have the following code ( I'm creating a binary tree and then I want to print the values on it's leafs) but when I'm running it, it never enters in that if from the parcurgere function. What have I done wrong? [CODE] void creare(node *p) { //your code } …

Member Avatar for 28daniela28
0
139
Member Avatar for StaticX

Yes you can do that, for example [code=c++] class A { public: int func() { return 1;}; }; class B { public: A a; }; int main() { B b; b.a.func(); } [/code]

Member Avatar for StaticX
0
104
Member Avatar for kppowell

I know i shouldn't be stretching it more but this is funny .. I'm sure the OP would have become quite a programmer by now... prince of persia :) ...

Member Avatar for sonu babu
0
280
Member Avatar for problemkid

Another approach could be: 1. Read in a number as a string 2. Take one character from the front, convert it into a number and push it in a stack - Stack-1 3. Keep doing step 2 till you've pushed the entire string on the stack with the least significant …

Member Avatar for dusktreader
0
143
Member Avatar for ppotter3

[QUOTE=ppotter3;1112886] [CODE] void SearchNames(string names[], int &rTotal, string &rNameONE, string &rNameTWO, int &rCount_NameONE, int &rCount_NameTWO, bool result_NameONE, bool result_NameTWO) { /* This is the search function that implements a basic brut force search to find the specified names that the user inputs. */ rCount_NameONE = 0; rCount_NameTWO = 0; result_NameONE …

Member Avatar for ppotter3
0
204
Member Avatar for cerr

[QUOTE=cerr;1113445]Hey all! I have this assignment for my school project to create a simple address book using classes that do the routine stuff like adding a contact, searching it, modifying it, deleting it... Here is the code but it won't run properly. I tried but couldn't figure it out. It'd …

Member Avatar for cerr
0
152
Member Avatar for wot

[QUOTE=wot;1113585]Hey guys, I'm new to C and I am trying to find a way to create a file with the following array: [/QUOTE] And if you are trying to learn C, you'd be better off posting questions in the C forum or you might get a little mixed up.

Member Avatar for Kurt Kubing
0
160
Member Avatar for sexyzebra19
Member Avatar for sexyzebra19
0
96
Member Avatar for webdragon89

[QUOTE=webdragon89;1113220]I have n!/((n-r)!r!) which I figured out how to make recursive: [CODE]int crn (int n, int r) { if (r==0||r==n) return 1; return (n-1)+(n-1,r-1); }[/CODE] how do I make it non-recursive?[/QUOTE] what is this?? This is not a program, nor is it a recursive function and it does not calculate …

Member Avatar for Agni
0
121
Member Avatar for sidra 100

[QUOTE=sidra 100;1111808] Two constructors: A default constructor: A constructor that initializes the attribute ms where ms is the maxSpeed. An overloaded constructor: A constructor that takes ms as an argument, where ms is the maxSpeed.· [/quote] 1-> You have not defined the overloaded constructor body. 2-> Are you sure you …

Member Avatar for sidra 100
0
127
Member Avatar for atticusr5

Either define the cCourselist ctor or remove it's declaration from the class body so that the compiler is able to define one for the class

Member Avatar for Ancient Dragon
0
155
Member Avatar for swolll

These are the 2 overloaded declarations of erase in vector: [code] iterator erase( iterator loc ); iterator erase( iterator start, iterator end ); [/code] Both of them take an iterator as argument and not int

Member Avatar for Agni
0
179
Member Avatar for ishaiman

We do not do other people's assignment. If you try to do it on your own and get stuck then you can post the code here and ask specific questions about the problems you are facing. That's the way it works.

Member Avatar for sidra 100
-3
301
Member Avatar for Nikhar

I don't thing it is overly complicated, seems neat to me. You could divide the class declaration and function definitions in different files, .h and .cpp and main could be in another 3rd file which includes graph.h and just uses whatever it wants to. You can define the structs edges …

Member Avatar for Nikhar
-1
110
Member Avatar for tizzo233

in case you are wondering, why you haven't got any useful replies, let me tell you. The question is vague, you have not provided any main function so we don't know which functions you want to call, how is your input stored and why you are not able to pass …

Member Avatar for Agni
0
110
Member Avatar for Agni

[code=c++] int main() { int i=10; char arr[i]; } [/code] I was expecting an error but it is compiling without any issues. I'm assuming the g++ compiler is doing something but not sure how to disable that. This is my compiler info [quote] Using built-in specs. Target: i486-linux-gnu Configured with: …

Member Avatar for Agni
0
139
Member Avatar for DavidDD

A very quick answer: You will have to use dynamic arrays [code=c++] int* arr = new int[word.length]; [/code]

Member Avatar for DavidDD
0
127
Member Avatar for sidra 100

You are using pass-by-value semantics for passing method parameters as a result the changes you make, to the object, inside the functions have not effect on the actual object. Pass the parameters by reference and try.

Member Avatar for Agni
0
78
Member Avatar for Stefano Mtangoo

and shouldn't this [code=c++]AdditionalWindows(*wxWindow parent); [/code] be [code=c++]AdditionalWindows(wxWindow* parent); [/code] ?

Member Avatar for Stefano Mtangoo
0
783
Member Avatar for Jetsetivan

[QUOTE=Jetsetivan;1104299] [CODE] int main() { // Request and obtain valid decimal numbers int A = obtaindec('A'); int B = obtaindec('B'); // Convert A and B to binary and store as vector<char> arrays vector<char> Abin = dectobinstring('A', A); vector<char> Bbin = dectobinstring('B', B); // Create C based on the largest size …

Member Avatar for Jetsetivan
0
200
Member Avatar for DavidDD

[QUOTE=DavidDD;1103859] [CODE] void mainSPGameFunc() { readFileGetRandom(); string sSelectedWord = readFileGetRandom(); string sGuess; int iWordLength = sSelectedWord.length(); cout << "Guess the word!\n"; for(int i = 0; i < iWordLength; i++) { cout << "_ "; } cin >> sGuess; [B]for(int i = 0; i < iWordLength; i++) { if(sGuess == sSelectedWord[i]) …

Member Avatar for DavidDD
1
129
Member Avatar for belle phoenix

Well that's one big code you've posted there, nobody can help you on that quickly, unless you clearly mark out a piece of code that is not working correctly or state your problem in much simpler manner or just about anything that makes one focus on some part of the …

Member Avatar for Agni
-3
321
Member Avatar for jigglywiggly

Well the code is doing what it's supposed to do, but I don't understand this, why are you doing this on your 4th day of C++ ? If it's just a matter of this piece of code then may be it's ok but if this is how you are trying …

Member Avatar for Agni
0
160
Member Avatar for flying_bird

[QUOTE=flying_bird;1097490] [code] template <typename T, typename LESS_THAN> void RestrictedSet::insert (const T elem) { _S.insert (elem); if (++_size > _max_size) drop_worst(); } [/code] The problem must be somewhere in the template part, I get the error: [icode] agenda.cpp:28: error: ‘template<class T> class RestrictedSet’ used without template parameters agenda.cpp:28: error: variable or …

Member Avatar for flying_bird
0
772
Member Avatar for jakesee

[QUOTE=jakesee;1096502]Hi, This is a very convoluted problem I spent hours debugging to find that when I call std::vector<object>::push_back(Object()) destructor of previous Object is called. Is this the behaviour of std::vectors or is something wrong with my code? [/QUOTE] It could be happening due to resizing of the vector. Once the …

Member Avatar for jakesee
0
467
Member Avatar for vespasianvs

Since sm_fileData is static member, wherever you are defining it, at that point the default ctor of class QFile is getting called and sm_fileData is getting initialized. You cannot call another ctor on it at any later point of time. You can try using the QFile's open function (cross check …

Member Avatar for vespasianvs
0
735
Member Avatar for Excizted

It is not clear from your post what exactly you wanted to do. Did you want a function pointer to a static class member function? That is not so difficult and in fact is same as non-class functions. However since the code you have posted does not contain any classes, …

Member Avatar for Agni
0
146
Member Avatar for rgpii

[code=c++] template <typename Type> void dbList<Type>::insertNode(Type v) { Node<Type>* tempa; Node<Type>* tempb; Node<Type>* tempc; tempa->data=v; if(this->head==0) { this ->head = tempa; this ->head ->next = 0; this ->head ->prev = 0; this ->size++; this ->head->position=size; } else { tempb = this ->head; if(tempb ->next == 0) { tempa->next = tempb->next; …

Member Avatar for Agni
0
118
Member Avatar for doraemon79

It doesn't look like C++ code at all. And the moderators might prove that in sometime by moving it to the C forum !!

Member Avatar for doraemon79
0
2K
Member Avatar for GDICommander

[quote]InvalidArgumentException::InvalidArgumentException(class InvalidArgumentException const &)" (??0InvalidArgumentException@@AAE@ABV0@@Z)[/quote] I think the problem is that your copy ctor is declared but not defined and somewhere you are trying to make a copy of your class 'InvalidArgumentException' . [code=c++]InvalidArgumentException(const InvalidArgumentException&);[/code] so you could either provide a copy ctor definition or remove any copy attempts from …

Member Avatar for GDICommander
0
170
Member Avatar for esmeco

IMO you should create those objects separately and then add them to the vectors and sets of the factory class. Factory, in your case (and very misleadingly), looks like a collection of all other types and I don't think you should create these objects in the Factory, rather, just create …

Member Avatar for Agni
0
110
Member Avatar for BobFX

[code]Form1 ff = gcnew Form1();[/code] it probably want's you to declare 'ff as a 'Form1*', but i could be wrong since i've never seen the 'gcnew' operator before.

Member Avatar for BobFX
0
124
Member Avatar for timtianchen

[quote]I must be missing something, how do I properly return a 2-d string array from a function?[/quote] you could do something like [code=c++] typedef string (*StrArrPtr)[numCols]; StrArrPtr get_elements() { //Do your stuff, string arr[numrows][numcols] return arr; } [/code] words of caution: Make sure you are not returning address of a …

Member Avatar for monkey_king
0
148
Member Avatar for new programer

[code=c++]string_in[j][i]!=un_lock[j][/code] un_lock is a string, and un_lock[j] is a 'char' at position 'j'. while string_in[j][j] is a string. hence the error. You are trying to compare a string with a char and the compiler tells you that it is not allowed. You're 2nd attempt just changes the error because you …

Member Avatar for Agni
0
156
Member Avatar for qwertymk

[QUOTE=qwertymk;1085717]So basically this is all that is required? [CODE] ~live() { if (_next) delete _next; } [/CODE] for the destuctor?[/QUOTE] you don't need the 'if' either, if _next is NULL then delete will not create any problems.

Member Avatar for Agni
0
110
Member Avatar for Agni

[code=c++] class A: public B { C* p1; C* p2; } [/code] What would be a correct assignment operator for class A? We have to ensure that we do not leave any object in an inconsistent state due to any exceptions or create any dangling references or memory leaks.

Member Avatar for Dave Sinkula
0
153
Member Avatar for NicAx64

Why don't you use a 'vector' class instead of arrays? It would be much easier to use.

Member Avatar for NicAx64
0
151
Member Avatar for FancyShoes

[code=c++] while( (g.one != 'r') || (g.two != 'p') || (g.three != 'g') || (g.four != 'm')) [/code] that's how you give multiple values, you can modify it to suit your requirement

Member Avatar for FancyShoes
0
133
Member Avatar for nychick

[code=c++] //input/output functions //void read(); friend istream &operator>>(istream &str, Date&d) { char skip_char; str >> mn >> skip_char >> dy >> skip_char >> yr; } [/code] The compiler might be asking you to access 'mn' , 'dy' , 'yr' using the Date reference. something like [code=c++] str >> d.mn ... …

Member Avatar for jonsca
0
89

The End.