I suggest simplying your entire code to about the same length as you have posted. You don't show us any non-virtual classes, and you don't show how AlphaBeta is constructed.
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 205
Skill Endorsements: 8
It looks like you are reading in all of the values, then only writing out the matrix once. What you have looks good, but I would suggest making it into a function, and using variable names that are descriptive:
void PrintMatrix(int matrix[10][10]; const int numberOfRows, const int numberOfColumns)
{
for(int row = 0; row < numberOfRows; row++)
{
cout<<endl;
for(int column = 0; column < numberOfColumns; column++)
{
cout<<a[i][j]<<" ";
}
}
}
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 205
Skill Endorsements: 8
QLabel::QLabel(const QLabel&) is called the copy constructor, and it is indeed private, so you cannot use it. You are trying to use it by copying your object when you pass it to the function. You should accept a const reference to the object instead:
void Test(const QLabel& yourLabel)
David
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 205
Skill Endorsements: 8
You are explicitly asking the user for the dimensions, so what is the problem? You have to assume either row-major or column-major (i.e. for:
1 2
3 4
row major ordering would be (1,2,3,4) where column major would be (1,3,2,4) ), but once you specify how you expect the input there is no reason to need line break characters, etc.
Also, please please please change variable names like 'd', and 'e' to "numberOfRows", etc.
David
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 205
Skill Endorsements: 8
Please include the entire compiler output. Which identifier is not found? My guess would be read_file, since you didn't declare it before main.
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 205
Skill Endorsements: 8
For starters, I would suggest never using spaces in a file name :)
If you insist on doing so, I think Windows likes backslashes instead of forward slashes - I don't if c++ cares about this.
Also, you may need to "escape" the space with a backslash:
read_file("F:/2nd\ year_2/Data structure 2/books/lecture-26.pdf");
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 205
Skill Endorsements: 8
You'll have to provide more information. Do you really need to store all 1000 of these 3000x3000 matrices? If so, then you're just out of luck :). Give us an explanation of the algorithm.
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 205
Skill Endorsements: 8
Yea if its getting to 95% right before it crashes that is definitely an "out of memory".
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 205
Skill Endorsements: 8
I think you should verify that it is indeed an "out of memory" before we look into it too far. I can't give you exact instructions because I'm on linux at the moment, but I believe if you open the task manager there should be some plots/statistics about cpu/memory usage. I'd leave that open while you run the program and if it goes up and up and up and gets to the top and then crashes then you've found the problem :)
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 205
Skill Endorsements: 8
Are you deleting the memory you are allocating with malloc? Depending on how big these matrices are, maybe you are running out of memory? Do you need to keep each of these 4000 matrices? Or just use it and then discard it?
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 205
Skill Endorsements: 8
Before messing around with a printBoard() function, you should make some examples for yourself to make sure you understand the basics. Create a string and output it. Does it look correct?
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 205
Skill Endorsements: 8
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 205
Skill Endorsements: 8
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 205
Skill Endorsements: 8
It looks like you missed copying/pasting the critical line to answer this question! (The function declaration is missing!)
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 205
Skill Endorsements: 8
You should use more descriptive names. What is 'sz'? What does 'calc' do?
You should also post the shortest compilable example you can make that demonstrates the problem.
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 205
Skill Endorsements: 8
I suggest creating a function called OutputBinary(int lengthOfNumbers) and testing it by hardcoding a call to OutputBinary(3). This way you will be able to tell if the problem is with your output of if it is with your user input.
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 205
Skill Endorsements: 8
Sreekiran,
As a small side note, please use real English words like "please" instead of "plz" - it helps keep Daniweb looking professional!
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 205
Skill Endorsements: 8
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 205
Skill Endorsements: 8
I think you're missing two semicolons:
#include <iostream>
class Hop
{
protected:
static struct NStrct
{
int nCount;
} test;
};
int main()
{
return 0;
}
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 205
Skill Endorsements: 8
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 205
Skill Endorsements: 8