|
this is all the code from the beginning of the class :
#include<iostream.h>
#include<string.h>
class Stock
{
private:
char nameCompany [10];
char market [10];
char tickerSymbol[10];
int stockValue;
int currentStockPrice;
char manufacturingCompany[2];
static int outstandingShares;
public:
Stock ();
Stock (char[] name , char[] mark , char[] ticker , int value , int curPrice , char[] company , int shares);
void display();
};
Stock::Stock() // empty constructor
{
}
Stock::Stock (char[] name, char[] mark , char[] ticker , int value , int curPrice , char[] company , int shares)
{
strcpy(nameCompany , name);//copy the array name to the array nameCompany
strcpy(market , mark);
strcpy(tickerSymbol , ticker);
stockValue = value;
currentStockPrice = curPrice;
strcpy(manufactringCompany , company);
outstandingShares = shares;
}
int Stock:: outstandingShares = 0;
/*display method*/
void Stock:: display()
{
int i = 0;
for( i ; i<10/*nameCompany.size*/ ; i++)
cout<
|
|
|
|
|
I got it! One of those syntax errors one can stare for hours whitout noticing: [] s are in the wrong place, it should be
Stock (char name[], char mark[] , char ticker[] , int value , int curPrice , char company[] , int shares); Regards.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi.
I have used Linux in the past including Red Hat and Debian. I like Debian better because of its huge library of software packages. Red Hat was faster to install and get working, but I had difficulty compiling and updating new builds of kernel.
Anyways, I enjoy programming using C++. That is all I want to do if possible.
What is the best/prefer Linux distribution for developers (C++)?
What is the best/prefer X (Gnome, KDE, etc.) for developers (C++)? My college uses Red Hat + KDE.
Thanks,
Kuphryn
|
|
|
|
|
This is a *windows* programming board. I doubt you'll get many (if any) replies other than this one.
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
There are those of us that need to do Windows for work, but enjoy Free software outside of the work place.
I think we'll all be doing KDE one day, probably in about 5-10 years. There are several things that areleady heppening that are mapping this out: From Microsoft: .Net will fail like the XFL, MS licensing will become too expensive, restrictive and intrusive. I'm not even going to touch the settlement, cause that's so up in the air. Meanwhile Linux penetrates thanks to: IBM, Compaq, and HP, will pushing Linux (even more so then than now)(And enhancing it at the same time.) Much like the PC hardware of the 80's it will filter down from big servers to the work desktops to the home desktops. Once Linux is out in enough places, developers (that's you) will catch on to the idea that I can develop and app and write it once, then just compile it for each architecture you want to shio on and whalla, you're market isn't just x86 linux boxes, but PPC (incuding and not including Macs) Suns, DEC Alphas, SGIs, etc. -- All with 1 hour of porting, per port. (I'm including time to set up the cross compiler). /* I don't know why MS doesn't drop Windows and go with Linux. OS is not a very big chunk of revenue for them, meanwhile if they went linux, they could support all the architectures above and have the huge market - and wouldn't have to worry about Mac office being seprate from PC Office */
As you can tell I'm a Linux advocate. What you probably don't know is that I do embedded systems, and Linux is great for this, much better than Winders. In Windows, are you targeting XP embedded or CE? CE is nothing but a buch of headaches to program for. Just look at the docs. The exception to the rule is always CE. With Linux, it's the same at the device, PC or mainframe level. Couple that with Java VMs that are ~100k bytes, and you have a system that can run on alot more CPUs and arch's than Windows ever could.
Anyway, I gotta get back to work.
|
|
|
|
|
KDE - Been there, done that, moved on. Runs like Windows 2.0 (yes, I actually used Windows 2.0).
People always talk about how great the Linux applications are. I have tried them. They just don't stack up.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
What do you mean?
True, it takes forever to start an app. This is due to the fact that everything is a class and has to be dynamically linked, relocated, etc. v3.0 (which should be out shortly, (it's already in beta)) should fix this issue.
I'd like to know what Windows 2.0 was like, and what about KDE made you think of it as Win2.0.
|
|
|
|
|
SLOOOOOOOOOOOOOOOOOOOOOW (and that is on a dual 1ghz system).
Now what is this about classes having to be dynamically linked etc? Did the linux compilers do something really stupid and add extra overhead to C++ classes? C++ and C bindings should use the same mechanism with just slight variances in calling standards.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Well, KDE apps are classes to the core, as a result there is a lot to link up - a lot more than in a C app. The standard linker does and excelent job of what it's supposed to do, but it's not optimized for this everything-has-to-be-dynamically-linked situation.
I'll refer you to: http://www.suse.de/~bastian/Export/linking.txt -- that will explain it a whole lot better than I can. The immediate hack for 2.2 is to get apps that are mostly pre-linked.
I forget what's going on with 3.0 to fix this, but it is a issue being fixed for the next version.
I'm looking forward to evaluating 3.0 before I declare any real architecture issues.
|
|
|
|
|
Hmm, I wonder why this isn't a problem on Windows, or at least why nobody really bitches about it.
I totally forgot about the vtables which is why I didn't see why C++ would be slower. But of course, if the image is not based (or fixed), then the vtables would have to all be patched. Maybe that is why it isn't a big problem on Windows, many images are based.
Thanks for the info
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
I believe this to be because Windows is C based. True there are C wrappers (MFC) and such that just wrap the C libraries. As a result, there is a whole lot less low-level linking. (You're looking at 2-3 layers instead of about 7-9, IIRC and very small and few vtables.) Linux (KDE) developers, need not just to be correct, but poetic too, so everything is a class. This unfortuneately results in a lot of linking.
Well, partly answers your question. The other answer is because of "Quick Launch" apps. (Which has also been proposed for KDE) These apps clutter your bar, add time to your boot sequence, and pre-load the libraries for the application. So Windows isn't quite as fast as it seems either
|
|
|
|
|
You missed the point of my reply entirely.
This the is Visual C++ message board. Since Visual C++ is ONLY available for Windows, it would be completely correct to assume that everybody that moniotrs this board does so in the interest of Visual C++.
Kindly keep the linux discussions to the lounge or Rant/Rave.
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
This isn't entirely correct.
The situation is complicated by the aforementioned WINE and the fact that the VC++ sudio can be used as a nice editor for any C++ application on any OS.
And pardon me, but I really resent the fact that you attempt to censure this board as such. Let the lack of knowlege by members of the board be the force that makes people look for answers elsewhere, if there isn't the knowlege here to begin with. You will not stop me from helping people if I know the answer. If you wish to censure the board, maybe you should install some sort of moderation system.
One off-topic post really shouldn't warrent censure. Are you worried about pissing off the sponsors?
|
|
|
|
|
This is very easy question to answer.. for you.
Since you're of the C++ persuasion, go with KDE. It is C++ oriented, built with C++ and suffers from C++ problems.
If you were of the C persuasion, go with GNOME. It is C oriented, built on C and suffers from C problems.
I know bindings exist so you can use either in either, but it's best to stick with what it started from.
From the little bit I've looked into writing apps for these two, KDE looks a lot easier because of the classes.
|
|
|
|
|
If you want to earn any money, forget desktop programming for Linux. Linux has less than 5% of share on desktop PCs.
I vote pro drink
|
|
|
|
|
Was he asking about desktop programming or just which desktop is the best?
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Well, he asked
"What is the best/prefer X (Gnome, KDE, etc.) for developers (C++)?"
I thought he meant programming for Gnome, KDE, etc, but who knows?
I vote pro drink
|
|
|
|
|
Good point.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Hi,
Checkout below site and tell me your idea about it
http://www.winehq.com/
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hey, thanks guys. I appreciate the reponses.
Tim Smith made an interesting point about Linux X applications running slow. I find that to be true. I find some programs in Linux start slower than a similar if not more robust programs running in XP.
Second, I believe most developers prefer GNU C++, but I find that it takes may a fraction of a second slower to compile than Borland C++ Builder 5.5 and VC++ .NET. Again, maybe that is just an illusion because I use GNU C++ in console mode.
As for X, I have always used GNOME when I installed Red Hat and Debian. I did not know developers use C for GNOME and C++ for KDE. That is good information.
Kuphryn
|
|
|
|
|
Hello,
I am using an example posted in a article by Michael Dunn (I have modified it a bit to fit my needs).. Here is the sample of code that I am using..
void CConsoleView::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
{
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
*pResult = CDRF_DODEFAULT;
if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
{
*pResult = CDRF_NOTIFYITEMDRAW;
}
else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
{
COLORREF crText;
long nItems = GetListCtrl().GetItemCount();
while(nItems > 0)
{
if(!GetListCtrl().GetItemText(nItems-1,7).Compare("Stopped"))
{
if (long (pLVCD->nmcd.dwItemSpec) == nItems-1 )
crText = RGB(255,0,0);
}
else
{
if (long (pLVCD->nmcd.dwItemSpec) == nItems-1 )
crText = RGB(0,0,0);
}
nItems--;
}
pLVCD->clrText = crText;
*pResult = CDRF_DODEFAULT;
}
}
The problem that I am having is that the first 2 columns do not get repainted.. the rest of the list gets colored perfectly.. Any ideas?
Thanks,
Rob
|
|
|
|
|
Unfortunately I don't know the solution, but why don't you use
int nItems;
there's no need to use a long
modified 12-Sep-18 21:01pm.
|
|
|
|
|
When I used a int and did the (pLVCD->nmcd.dwItemSpec) == nItems-1;
The compiler was giving me a warning (something like sign/unsign)so I looked it up on MS and they said it was a known bug and to declare my int as a long.. this seemd to fix the warnings.. But even when I used a int it still was drawing funny..
After the list is drawn if I click on the item that was drawn and then click off of it.. it is then drawn correctly.. Maybe I need to GetFocus or something..
I'll play with it some more.. if anyone else has any ideas I would love to hear them.
Thanks
Rob
|
|
|
|
|
Well, since this drawing code is executed for every single item I think it's not neccessary to use a while()-loop.
Give this code a try, however, it is untested:
void CConsoleView::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
{
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast( pNMHDR );
*pResult = CDRF_DODEFAULT;
if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
{
*pResult = CDRF_NOTIFYITEMDRAW;
}
else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
{
COLORREF crText;
if(!GetListCtrl().GetItemText(pLVCD->nmcd.dwItemSpec,7).Compare("Stopped"))
crText = RGB(255,0,0);
else
crText = RGB(0,0,0);
pLVCD->clrText = crText;
*pResult = CDRF_DODEFAULT;
}
regards
Gregor
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Your code works fine.. It seems to do exactly the same thing as the loop.. I'd rather use your example vrs the loop, your example is much cleaner..
But the darn thing is still not drawing the correct color on the first 2 columns.. But if I click on the item and click off it draws correctly.. or if I scroll the first 2 columns out of the view of the list and scroll them back into view they are drawn correctly.
Weird..
Rob
|
|
|
|
|