565 Posted Topics
Re: This just doesn't work, your read the file into line one line at a time and each time overwrite the previous line before actually doing anything. Move the } below c++; down one line but still it doesn't do much. (other than actually print 1 lines 2 lines .... Normalize … | |
Re: In future please add the compiler error messages (well the first few). you seem to define your own iterators in spellcheck. That is going to cause problem LATER. pair<iterator,bool> requiires a complete type of YOUR iterator that is only pre-declared with the line [icode]class iterator;[/icode] Another problem is that [icode]list<EntryType>::iterator … | |
Re: Basically, don't try to do two things at once. You have (A) an array of Loanc and want (B) another array of Loanc. So [code=c++] int next(0); temp[0]=arr[0]; // MUST remember that you don't test the first for(int i=0;i<arrSz-1;i++) if (arr[i]!=arr[i+1]) temp[next++]=arr[i+1]; [/code] If arr is not sorted then you … | |
Re: Hope you don't mind an additional comment... If you shuffle the whole deck, you spend an amazing amount of time in the random number generator. It is a lot better (particularly for blackjack simulations -- where you only have a few cards to get out.), to generate the random cards … | |
Re: From the slightly overly-short section of code, (please post the rest of the while(!inFile.eof()) {.... }) I am guessing that you do not actually read any file. inFile.eof() only checks the state of the file (it is not at the end) If you do not have a readline / operator>> … | |
Re: I am sorry but I laughed! However, we all begin somewhere. I can't say my early stuff was any good. [having said that I am not sure what I write today is that good.] First off: the ; (semi-colon) is a statement end. It doesn't actually matter were you put … | |
Re: The reason is that anArray is local to the scope of the function. So by the time that you use it with the ptr is it out of scope. Old compilers, use to allow this (without warnings), and no end of mayhem followed. To get round this, you can (a) … | |
Re: I think a little care in needed here. Poster #4 suggested making a heap object of A. [new A(5)] but that is maybe not what you want. It adds a level of complexity that might not be needed. You have to delete ob in B's destructor and manage the memory … | |
Re: Ok. There are two problems with this. First, you cannot declare variables within the outer scope of a switch statement. Hence lines 16 and 19 are illegal. Second you have declared "enumerator" both at 16/19 (a local copy) and at line 6. So you need [code=c++] enum daysinweek em; switch(whatday) … | |
Re: First off I am going to deal with the minor errors. The the major problem. Number of minor errors: (A) Only constructors take the ":" assignment . Error in line 18 in destructor. It should read [icode] ~BinaryNode() {delete left; delete right;} [/icode] (B) Maybe delete line [icode] Compare compare … | |
Re: The lack of a . between student[i] and majorIn is fatal. | |
Re: The problem is that you can have the inline OR the declaration. You can't have both. So if you delete 5,6,7,8 all isl be fine. If you wish to define the function outside of the namespace definition then delete lines 10-17. | |
Re: Ok the problem, that doesn't actually occur until you try to create a version of the BinaryNode (from BinarySearchTree) is that you have written: BinaryNode(Key k, T i) : data(i), Key(k) Note that [I]Key[/I] is now a type [From Line 6]. You need to use key. Or please use a … | |
Re: The error is almost certainly in CSimpleList.h BUT why is the guard around the CSimpleList.h. Three lines below, should and almost certainly are in CSimpleList.h #ifndef CSIMPLELIST_H #define CSIMPLELIST_H #endif //CSIMPLELIST_H That might be your problem, by setting the guard, you have avoided loading CSimpleList.h, since it has a repeat … | |
Re: My guess is that you have a template that cannot be expressed as a float/double type e.g. [code=c++] template<typename T> void printout(const T& Obj) { print("%2f",Obj); } [/code] and then [code=c++] class SomethingComplex { .... }; SomethingComplex A; printout(A); [/code] There are many possible solutions but why not use the … |
The End.