Thanks everyone you've been a great help.
Type: Posts; User: Bill83
Thanks everyone you've been a great help.
Hello,
I don't know if this is the place to ask this question, so please let me know. I developed my own CAD tool and the code is all written in C++. There is nothing graphic about it. I'm just...
Thank you citizen (and the rest of you). You have all been a great help.
Thank you guys for all your help. Unfortunately I still don't understand why it is not working. I did start out as programming a vector class for double, then I changed it to a template. In the...
But just out of curiosity, how do I include vector as a data member if I don't have anywhere to use it in the class definitions?
This is actually the first time I ever programmed with templates, so obviously I didn't get the whole picture. I think I'll just get rid of the vector class altogether and just create a dynamic array.
Hello,
I am having trouble with the error message in the title: "Left operand must be l-value." I created a template class as follows:
template <class T>
class vector
{
T *ptr;
Thanks. I'll let you know how it works.
I thought eof() was the end-of-file condition. I need something to check if you reached the end of a line.
Hi all,
I was wondering if, when reading from a file, there is a way (or an algorithm) to check if you reached the end of a line.
Thanks.
Hi all,
I just have a simple question: does there exist a command to move the mouse pointer on the screen without physically moving the mouse (e.g. put it at center position)?
Thanks.
Bill
Got it. Thanks for that.
Ok I get it. So you're saying that you need to delete your memory to keep your program running smoothly? And say that, just as in your example, you forget to delete and the program becomes very slow...
Automatically? If that's the case, why is it so important to use delete?
I have a small question. If you use the new keyword but forget to delete, I know that there exists unfreed occupied space in the heap. Does that unfreed space remain that way forever, or is there a...
I FINALLY GOT IT!!! Turns out the problem was with the general constructor: I forgot to assign values for the individual data members (row, col, and empty). For some reason, after assigning the...
Sorry about the last comment. I forgot to close to code tag
Turns out it is not printing at all. I tried using both the assignment operator and the copy constructor, but nothing works. It basically is never outputting to the screen. I am doing
Matrix...
Sorry if I didn't mention this before, but yes I did run both your examples and I did get the same output. I am using Microsoft Visuall C++ 6.0.
After chaning the overloaded assignment operator, I tried to redo everything as before (i.e. passing by const reference, etc.), but it is still not outputting. ARRRRRGH!!!!
You're definately right. Here is the corrected version:
Matrix Matrix::operator=(const Matrix &another)
{
//clearing heap
if(!empty)
{
for (int i=0; i<row; i++)
Thanks all. My head is going to explode. I actually didn't expect you to stay that long on the topic. Anyway, I think I'll call it a night. Tomorrow's another day.
Sure. Here is the whole header file:
//#include "Complex.h"
class Matrix
{
int row,col;
Complex **A;
Ok so apparently the destructor IS called before. That is not my worry anymore I guess. But why is it not outputting to the screen with my Matrix class?
Wow thank you guys for going through all that trouble. In my Complex class, it all works similarly. It is only my Matrix class that's giving me trouble. In case you want to compare the ostream...