|
Marc Clifton wrote:
Trollslayer wrote:
The "No programming questions please." wasn't big enough...
Actually, it appears to have disappeared. Or at least, I can't see it. Hmmm....
Yes, in fact it is "Please do NOT post programming questions or ads to this forum.". Maybe too long and confusing sentence?
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
dnh wrote:
Yes, in fact it is "Please do NOT post programming questions or ads to this forum.". Maybe too long and confusing sentence?
Oh, I see it now!
Posting Guideline: The Lounge is rated PG. If you're about to post something you wouldn't want your kid sister to read then don't post it. * Do not post programming questions (use the programming forums for that) and please don't post ads.
I stopped reading that paragraph where I placed the "*", thinking the rest of the paragraph was more rambling about PG and kid sisters. It used to be more obvious, IIRC.
Oh well. I'm blind. I admit it.
Marc
My website
Traceract
Understanding Simple Data Binding
Diary Of A CEO - Preface
|
|
|
|
|
Marc Clifton wrote:
I stopped reading that paragraph where I placed the "*", thinking the rest of the paragraph was more rambling about PG and kid sisters.
hmm maybe that's the reason why people post programming questions?
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
Sveta80 wrote:
I know that I should use something like this:
Actually, you should be using C# so you can write:
ArrayList myChars=new ArrayList();
...
myChars.Add(myKeyboardChar);
Isn't that so much simpler than pointers and constructors and destructors and malloc and realloc and STL and...(errr, oops!).
Marc
My website
Traceract
Understanding Simple Data Binding
Diary Of A CEO - Preface
|
|
|
|
|
Or alternatively in C++
vector<char> myChars;
...
myChars.push_back(myKeyboardChar);
I can see how much more complex the C++ solution is over
C# here.
It is a fact that there are almost not circumstances when
it is necessary to use new and delete in C++ anymore,
it is almost always better to use a Standard library
container, which handles all that stuff for you.
However, Microsoft's secret plan to replace C++ with
C# is that they make these containers very hard to use
within the debugger. Debugging support of the STL really
blows in VS 2003. Has anybody tried it out in VS 2005?
|
|
|
|
|
nde_plume wrote:
It is a fact that there are almost not circumstances when
it is necessary to use new and delete in C++ anymore,
Oh, I don't know about that. There's plenty of times when I need a countainer to maintain a reference to an object that isn't constructed on the stack.
nde_plume wrote:
However, Microsoft's secret plan to replace C++ with
C# is that they make these containers very hard to use
within the debugger.
Not really. STL has been a PITA to debug since the days when I was using Sun's STL. Drilling into a collection in STL is like bumbling around in a universe consisting of 3.2 dimensions. If anything, maybe Microsoft has made is easier, not harder, to debug.
Marc
My website
Traceract
Understanding Simple Data Binding
Diary Of A CEO - Preface
|
|
|
|
|
However, Microsoft's secret plan to replace C++ with
C# is that they make these containers very hard to use
within the debugger
You really think it isn't possible to present containers
in an easier way in the debugger? Heck, if you are using
a vector you can hack the debugger to display the contents
by typing this in the watch window:
my_vector._Myfirst,10
shows the first ten items in the vector in a fairly nice
way. There is no reason at all why the debugger can't do
that itself. It is much harder with tree structures like
maps and sets to view by hand in the debugger (though you
can walk throught it, so the data is certainly renderable)
it is just that MS didn't think it was very important.
|
|
|
|
|
|
Hi, thanks for posting your interesting C++ question in Lounge!
I'll be glad to help out!
You'll probably be looking for something like this:
while ( get_keybrd_inpt()->is_num_pos() ? true : false >> 0 ) {
int s = 1234 * (2 >> 8 / 3 % 4 <<1) * 3 ? 200: 7;
int&* p = new int[s];
for ( (*p.->len()++).ossfet+1; ; ) {
s = p->query_length_ctr() + 1 * (*p->offset);
p = new (int)(p)[s];
}
}
else ( break; ) { set_jmp(120); asm{ _int 3;} exit( if_ctl_C_ht() ); }
That should do the trick. Let us know how this works for you!
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
-- modified at 16:08 Sunday 11th September, 2005
|
|
|
|
|
Not sure at the end of the day if you feel your question has been answered. The answer is std::vector. Put #include <vector> at the top of your code, and then using std::vector just below. Then in your code you define a vector like this vector<type> = name; For example
#include <vector>
#include <string>
using std::vector;
using std::string;
int main()
{
vector<int> vecInt;
vector<string> vecString;
vecInt.push_back(1);
vecInt.push_back(2341);
vecInt.push_back(341);
vecInt.push_back(176);
vecString.push_back("fsdfsdfdf");
vecString.push_back("fgkkf");
vecString.push_back("45j4");
// Now this is how we use it
vector<int>::iterator begin = vecInt.begin();
int total = 0;
for(;begin != vecInt.end();++it)
{
total += *begin; // You need to dereference the iterator to get the value.
}
// You could also use the algorithm in <algorithm> to do stuff like this.
}
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Sveta80 wrote:
pointer = new int [size];
but when I go to my for loop what do I say my size should be?
You would loop from 0 to size times. For example:
int size = 10;
int *pointer = new int[size];
for (int x = 0; x < size; x++)
{
cout << "Enter number " << x << ": ";
cin >> pointer[x];
}
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
But the problem is that I don't know the actual size of my array. My size depends on the user input and I don't know in advance how many numbers my user is going to enter. User can enter 10, 20, 100 numbers. After the user finished entering the numbers, my code should read through them and whenever the input number is negative, the code should start sort the numbers it already got (except the negative number) and prints the orders.
|
|
|
|
|
But the problem is that I don't know the actual size of my array. My size depends on the user input and I don't know in advance how many numbers my user is going to enter. User can enter 10, 20, 100 numbers. After the user finished entering the numbers, my code should read through them and whenever the input number is negative, the code should start sort the numbers it already got (except the negative number) and prints the orders.
|
|
|
|
|
In that case, one of the other suggestions is more in line with what you need. You can, however, ask the user how many numbers s/he will be entering and allocate an array that big. Good luck.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I'm creating an ActiveX control via ATL. It's something like ruler. So I draw a lot of scale marks and captions under it.
Also I implemented scrolling the window by mouse handling WM_MOUSEMOVE message and calling ScrollWindowEx function from there. And I paint all I need in WM_ERASEBACKGROUND message handler to overome flickering problems.
Everything works fine, but I have a little flickering effect.
And also everyting paints slowly, if one moves mouse fast.
How can I solve this problem?
|
|
|
|
|
When you draw, are you trying to draw the whole control, including the parts that are not visible, or do you limit your drawing to the visible portions of the control only?
If your drawing code is spending lots of time trying to do stuff that is not even visible then you are just wasting CPU time and slowing everything down, causing the effects you are seeing.
[EDIT]
Also check out the GetClipBox() function.
[/EDIT]
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
-- modified at 16:13 Sunday 11th September, 2005
|
|
|
|
|
Big thanks, PJ Arends. Especially for the GetClipBox function!
I will now try to draw this way.
|
|
|
|
|
Dear friends,
I'd a problem. Please see the code below.
int main()
{
ifstream infile("exclusion_set");
istream_iterator<string> input(infile),eos;
vector<string> vec;
copy(input,eos,inserter(vec,vec.begin()));
sort(vec.begin(),vec.end(),greater<string>());
ostream_iterator<string> output(cout,"\n");
unique_copy(vec.begin(),vec.end(),output);
return 0;
}
if "exclusion_set" file cotents are like this:
the and but that then are been
can can't cannot could did for
had have him his her its into
were which when with would
the output will be each word like
the
and
etc.......
But if i want to read each line in the specified vector instead of each word. How shall i do.Which parameter that i should set so that each line is read in vector element.Please help.
Thanking you,
yours sincerely,
bhadram
bhadram
|
|
|
|
|
Hi,
I'm using this wonderful Tab control :
http://www.codeproject.com/tabctrl/XPTabApp.asp[^]
my problem is that the background color of the tab control is white,and when i'm adding a window to a tab,the window background color is gray.
How can I set the Background color of the window to the tab control color?
I tried to set the transparent property of the window to true but it's not working.
Also,I tried to do this with the following:
CDC *pDC = MyWindow->GetDC();
SetBkColor(pDC->m_hDC , RGB(255,255,255));
ReleaseDC(pDC);
But again,it's not working.
anyone?
regards,
Eli
|
|
|
|
|
You can handle WM_ERASEBKGND message
|
|
|
|
|
It depends on the ... window.
Could you be more explicit ?
SkyWalker
|
|
|
|
|
hello ...
in my program i used MFC connected with ODBC.
in the interface i added some items : textboxes to show data, button to find records,and button to add records .
when i execute the program ,i connect to the database and see the interface , but no data is founded .
so please i want to know how can i show the data in the text box .
thanks
|
|
|
|
|
hi
for example ur textbox variable is m_name
and ur ODBC class for example CStudent class variable is obj
so the value of textbox is
m_name=obj.m_name;
UpdateData(false);
obj.m_name is ur database attribute
MFC programmer
-- modified at 13:42 Sunday 11th September, 2005
|
|
|
|
|
I have a matrix 100x100 which stores phases of oscillators. I need to display this matrix by using HSV color code. Please help me!
Thanks a lot!
h
-- modified at 5:08 Sunday 11th September, 2005
|
|
|
|
|