|
Hi. I use RemoveAt() to remove objects from a list every time a given object attribute reach a certain value. The problem is that the objects are reaching the point faster than RemoveAt() can remove them from list, so there's a huge queue growing. Anybody knows how I could fix it?
CaCaPe
|
|
|
|
|
Code ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi How REad with C++ HDD Serial number ?
Please Help me
|
|
|
|
|
Someone can answer how can I find the calculus that the windows make to adjust the screen resolution?
Can be a link to a tutorial or something like this.
|
|
|
|
|
I don't understand the question ? Are you asking for the code to change the screen resolution yourself, or what ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
ok, I want to know is, why when I choose the screen resolution 1024x768
the values are these? Why not 1024x128 or 1024x963 or 1358x768?
Why these numbes? why 1024x768, 800x600, 1280x1024. What is the base for the definition of these numbers?
|
|
|
|
|
Screen Resolution means the number of pixels available on the monitor. You can think of a computer screen as a grid that is divided into a whole bunch of little squares. Each of these squares, or pixels, can be a different color, or black.
Resolution is the size of this grid of pixels. 1024x768 means that the screen is a 1024 by 768 grid of pixels. If the resolution is set to bigger numbers, say 1600 by 1200, each individual pixel will be smaller, and so the display is sharper and clearer.
The reason screen resolutions are not arbitrary numbers like 1358x768 is that most monitors display in a 4:3 ratio, in other words the width is 4/3 of the height. Because of the physical size of the screen, a ratio of 4:3 works. However, if the screen resolution was 1024 by 128, everything on the screen would be stretched. Instead of being little squares, the pixels would be little rectangles, and the display would look weird and distorted.
|
|
|
|
|
Ben, thanks a lot. This is the answer that I was searching. I needed this cause I'm developing an app that needs to generate little images based on screen resolution.
Thanks a lot for you.
|
|
|
|
|
hi every one this is for the first time i am logged to this web site and i am a newbe to programming world and facing problems to implement simple programs
can u tell me with source code how to implement
--- binary serach program
--- finding out a plaindrome
---- what is fibonacii series program
and sorting algorithms like bubble sort and selection sort
|
|
|
|
|
gunwinder wrote: --- binary serach program
you meant binary search, didn't you ?
google[^]
gunwinder wrote: --- finding out a plaindrome
you meant palindrom, didn't you ?
google again[^] have some answers for you
gunwinder wrote: ---- what is fibonacii series program
you mean fibonacci, didn't you ?
guess what ? google[^] have the answer
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
How to detect if the keyboard is connected or not.
i am using win98 and XP.
|
|
|
|
|
How can I initialize elements of arrays along with its dynamic creation?
For eg:
char ch(0);
This will initialize the ch with zero.
But the following is not possible.
char* ar = new char[20](0);
Is there any method to obtain the intended result?
Thanks!
- NS -
|
|
|
|
|
|
NS17 wrote: char* ar = new char[20](0);
Is there any method to obtain the intended result?
what about this?
char* ar = new char[20];
memset(ar,'0',20);
|
|
|
|
|
Well, 0 and '0' differ. I strongly recommend
std::vector<char> ch(20);
--
The Blog: Bits and Pieces
|
|
|
|
|
I'm sorry!
I asked about a general method, not just for a char array.
I need to know, how to initialize an array of objects of a class. In this case memcpy will not be an effective method if the class contains any dynamic allocation/initialization during class object initialization.
For eg suppose the constructor of class C
C::C(int nMin)
{
m_nVals = (rand() % 10) + nMin;
m_ptr = new int( m_nVals );
...
...
}
Thanks!
- NS -
|
|
|
|
|
You're still not being very precise about what you want to accomplish.
m_ptr = new int( m_nVals ); You do know that this creates an int and initializes it to m_nVals , right?
If you still haven't read the suggestion on std::vector , then I suggest you do that and its documentation.
If you want each item initialized differently, then you should have said so - std::vector can only initialize all items to the same value.
--
The Blog: Bits and Pieces
|
|
|
|
|
It was a mistake.
I meant that
m_ptr = new int [ m_nVals ]
I'm not familar with std::vector.
Can you suggest any further references on std::vector?
Thank you.
- NS -
|
|
|
|
|
Are you asking about this scenario?
class myClass
{
public:
myClass();
};
void main()
{
myClass *objArr=new myClass[20];
}
If so, in this case class's default constructor get called. You need to write one to get this compiled.
And that is your chance for any initialization. This is by design
|
|
|
|
|
|
does anybody know any free tools for format source code?
I know the .NET IDE menu include "Format selection" sub menu,
but, it's not good at format the whole document.
so, do you know the other free tool for format code?
thank you very much.
|
|
|
|
|
Hi,
A bit late in the day, but you could check out http://www.sourceforge.net/projects/astyle. It is a free ware syntax styling and indenting programme for C/C++/java/C#.
regards,
Rich
"Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
Ok here i am again the CP having hit my head on the wall as much as possible for this 2 days...
It was more that 1 year i didn't do anything in C#...
now after a lot of ice on my head i got it, my CDAWG
(Word here is a byte pointer)
the class is finally working, it takes imput strings, convert them to bytes and fill the tree... it's very unsafe.... i use ** and * with a clas for the heap memory allocation taken from the examples of the msdn very short code and always worked fine, this is why i am posting to c++ also.
What can i do now???
that's what i did, i took the wikipedia dump file with all their articles names, one per line.
it's 25Mb of a text that have an article name per line...
cool i'm loading it into my class.. and it does the insertion quite faster then what i thought.
the test on word are just WOW.. i mean... almost "instant"
but now the stuff is... why does it take 130Mb of Memory? shoudn't the tree be
"Compact"?
What i wanted to know is if any of you may tell me if this result is "normal"
should a 25Mb file made with one word per line take up to 130Mb when loaded into an normal CDAWG???
<- true inside to understand outside ->
<- true inside to understand outside ->
|
|
|
|
|
Why in Child if I don't specifically call base case and member object's copy ctor, their default ctor is called respectively instead?
#include <iostream>
using namespace std;
class Parent
{
int i;
public:
Parent(int ii) : i(ii) {
cout << "Parent(int ii)\n";
}
Parent(const Parent& b) : i(b.i) {
cout << "Parent(const Parent&)\n";
}
Parent() : i(0) { cout << "Parent()\n"; } friend ostream&
operator<<(ostream& os, const Parent& b) {
return os << "Parent: " << b.i << endl;
}
};
class Member
{
int i;
public:
Member(int ii) : i(ii) {
cout << "Member(int ii)\n";
}
Member(){ cout << "Member()\n"; }
Member(const Member& m) : i(m.i) {
cout << "Member(const Member&)\n";
}
friend ostream&
operator<<(ostream& os, const Member& m) {return os << "Member: " << m.i << endl;
}
};
class Child : public Parent
{
int i;
Member m;
public:
Child(int ii) : Parent(ii), i(ii), m(ii) {
cout << "Child(int ii)\n";
}
Child(const Child& c) : i(c.i) {}
friend ostream&
operator<<(ostream& os, const Child& c){
return os << (Parent&)c << c.m
<< "Child: " << c.i << endl;
}
};
int main() {
Child c(2);
cout << "calling copy-constructor: " << endl;
Child c2 = c;
cout << "values in c2:\n" << c2;
getchar();
}
|
|
|
|
|
Since you've chosen to implement a copy assignment ctor, you really have to do it properly. It's a ctor and it's up to you to choose how to initialize bases and members, just as with the default ctor. When you implement a copy assignment ctor, it's your responsibility to initialize everything correctly. If you don't provide specific initialization for bases or members, their default ctors are used for initialization.
If you don't implement a copy assignment ctor, the compiler will generate one that makes binary copies of PODs and calls copy assignment ctors where such are available.
--
The Blog: Bits and Pieces
-- modified at 2:29 Thursday 20th October, 2005
|
|
|
|