1,118 Posted Topics

Member Avatar for klactose

You haven't told the compiler what a [b]vector[/b] is, so it considers it an unknown type and goofs-up. Either add a [inlinecode]using std::vector;[/inlinecode] somewhere at the top, or say [inlinecode]std::vector <Car*> foo();[/inlinecode] Hope this helps. (Isn't it annoying when the silly stuff gets you?) [edit] BTW, the header file should …

Member Avatar for ArkM
0
171
Member Avatar for CoolGamer48

There is nothing wrong with it. You'll just get a reference to a temporary default. The best advice is to write [inlinecode]const std::string& error = std::string()[/inlinecode] as your argument. This will take strings and char*s equally. Hope this helps.

Member Avatar for Duoas
0
106
Member Avatar for supersoup

That's called an [b][i]operator overload[/i][/b]. The << and >> operators are bit-shift operators, but in C++ the STL uses them with iostreams as insertion and extraction operators. In other words: [inlinecode]cout << "Hello world!" << endl;[/inlinecode] cout is the left object << is the operator "Hello world!" is the right …

Member Avatar for Duoas
0
106
Member Avatar for ishaanarora

The FIFO will never have input until you write something to it. Since you don't write anything to it, [b]select[/b]() will always say that there is no input waiting. Remember, a FIFO [i]must[/i] be open at both ends (which you have done), and to read data you must [i]first[/i] write …

Member Avatar for ishaanarora
0
171
Member Avatar for Gromnie

The only two things I see that are guaranteed problems are first in [b]EnterName[/b](). You should input text using [b]getline[/b](). [code=C++] void WordRead::EnterName() { cout << "Type in the text file path you wish to read: "; cin.getline( theFile, 1000 ); } [/code] And second in [b]LoadFile[/b](), your loop will …

Member Avatar for Duoas
0
100
Member Avatar for henpecked1

"Overloading" (at least in C++) means that you have more than one function with the same name. In this case, you have three different constructors, but they all have the same name. The difference is the number and type of arguments it accepts. The first takes no arguments, so it …

Member Avatar for Duoas
0
134
Member Avatar for TheBeast32

You have discounted newline conversions. On Windows, the newline character represents the ASCII sequence CR LF. When your program reads it, it gets '\n'. The newline is encrypted thus and so the output file is shorter than the input file, because the encrypted data doesn't have as many '\n's (if …

Member Avatar for aminit
0
80
Member Avatar for Dannyo329

There is nothing inherently evil about [b]system[/b](), or executing other executables; just be aware that you must be careful how you do it.

Member Avatar for Duoas
0
4K
Member Avatar for greyghost86

You need to rethink why you are using a loop. Ideally, if you have to do things multiple times, it suggests a loop and/or an array. Since you need to remember five numbers, instead of writing: [inlinecode]int num, num1, num2, ...[/inlinecode] you can instead just use an array: [inlinecode]int items[ …

Member Avatar for Duoas
0
119
Member Avatar for carlos_lopez_m

They will remain separate programs, but I think you are asking if your C++ program can automatically run the VBA program so that the user doesn't have to? You have a variety of options. You can use [b]system[/b]() (#include <cstdlib>). [inlinecode]system( "\"C:\\Program Files\\MyVBAProgram\\VBAProg.exe\"" );[/inlinecode] On Windows you can use [URL="http://msdn.microsoft.com/en-us/library/bb762154(VS.85).aspx"][b]ShellExecuteEx[/b]()[/URL] …

Member Avatar for carlos_lopez_m
0
160
Member Avatar for edman

Ah, I see the problem. On line 52 you are assuming something about the input with [inlinecode](next >= 0)[/inlinecode]. (According to the instructions it should be [inlinecode](next > 0)[/inlinecode].) If you wish to use a semaphore item to terminate input, it must be passed as argument to the function. However, …

Member Avatar for edman
0
270
Member Avatar for Gusts

For the array problem: Without using an intermediary array of some kind (via recursion or on a stack or whatever) the only other way I can think to do it is with math. You'll need a bignum library, and a list of the first N prime numbers (where N is …

Member Avatar for Alex Edwards
0
307
Member Avatar for amit1701

Like [b]iamthwee[/b] indicated, there is no standard way to do that. You'll have to do something OS-specific. I suggest you check out the Curses library. POSIX: [URL="http://www.gnu.org/software/ncurses/"]NCurses[/URL] Win32: [URL="http://pdcurses.sourceforge.net/"]PDCurses[/URL] Hope this helps.

Member Avatar for iamthwee
0
159
Member Avatar for justinclev

[URL="http://www.codeguru.com/cpp/w-p/win32/tutorials/article.php/c8647/"]Win32[/URL] [URL="http://linux.die.net/man/2/reboot"]Linux[/URL] [URL="http://developer.apple.com/qa/qa2001/qa1134.html"]Mac OS X[/URL] Hope this helps.

Member Avatar for Duoas
0
106
Member Avatar for it2051229

[URL="http://en.wikipedia.org/wiki/Call_stack"]Some theory[/URL]. [URL="http://www.unixwiz.net/techtips/win32-callconv-asm.html"]More theory with concrete examples[/URL]. [URL="http://www.geocities.com/siliconvalley/park/3230/x86asm/asml1010.html"]Some actual assembly examples[/URL]. [URL="http://www.masm32.com/board/index.php"]A wonderful place for MASM/32 users[/URL]. Have fun!

Member Avatar for it2051229
0
140
Member Avatar for justinclev

Please don't shout. Adding a background depends on the toolkit you are using. If you are using straight Win32 API, you'll need to process the WM_PAINT message sent to the form and draw the bitmap before you let any other controls draw. If you are using a toolkit, please tell …

Member Avatar for CoolGamer48
0
146
Member Avatar for soultrav

I think you need to spend some time tracing through your algorithm. I'm not sure exactly what it is supposed to do, but I don't think it is doing what you want it to do... (Given "HELLO", the list it builds is H, E, L, LL, ...) In any case, …

Member Avatar for Narue
0
149
Member Avatar for Zozel

Using the old BGI functions you are pretty much out of luck... Sorry. Are you using an old Turbo C compiler or are you using the WinBGIm package?

Member Avatar for Zozel
0
3K
Member Avatar for brain

[code=C++] #include <algorithm> #include <functional> ... transform( a.begin(), a.end(), b.begin(), result.begin(), minus <pair <foo, bar> > () ); [/code] You'll have to define what the difference between two pairs<> is... (by overloading the - operator) Hope this helps.

Member Avatar for brain
0
102
Member Avatar for TheBeast32

The InputBox() function is a nice wrapper for some simpler API calls. [URL="http://www.codeproject.com/KB/dialog/w32inputbox_1.aspx"]Try here[/URL]. Hope this helps.

Member Avatar for TheBeast32
0
222
Member Avatar for titaniumdecoy

In C and C++, nothing is automatically initialized. (I'm pretty sure.) You can use the STL [B]fill_n[/B]() function to initialize it for you: [code=C++] #include <algorithm> // fill_n() and copy() #include <iostream> // cout, of course #include <iterator> // ostream_iterator<> #include <limits> // numeric_limits<> using namespace std; int main() { …

Member Avatar for Narue
0
106
Member Avatar for rovers9live

Probably not. LC3 only exists in textbooks and moreover, people who volunteer here don't want to do your homework for you. Give it an honest effort and we will help as you go along.

Member Avatar for Duoas
0
1K
Member Avatar for Thew

All objects in Delphi, including 'string', are allocated on the heap. When you resize a dynamic array the unused objects are automatically destructed for built-in types only -- so in this case, yes. When you set the length of a dynamic array to zero the dynamic array object itself is …

Member Avatar for Duoas
0
663
Member Avatar for QuantNeeds

The compiler believes that [b]seating[/b] is an integer. The OP placed the cast there to try to get rid of the error message. Can we see the class definition where [b]seating[/b] is declared? Is there anything else between the class and the variable? Did you #include the header in the …

Member Avatar for Duoas
0
3K
Member Avatar for titaniumdecoy

I don't know how you got that far... You never initialize [B]coeffs[/B]. You must set its length before playing with any elements. Or push elts onto the end. Hope this helps.

Member Avatar for Duoas
0
140
Member Avatar for hacker9801

[URL="http://www.parashift.com/c++-faq-lite/operator-overloading.html#faq-13.15"]C++FAQ-Lite 13.15[/URL] Hope this helps.

Member Avatar for hacker9801
0
115
Member Avatar for aveervani

You'll have to google for each of these. The grid classes have methods to insert and delete rows. To display things other than text you'll need to set the [B]DefaultDrawing[/B] property to [B]false[/B] and override the [B]OnDrawCell[/B] event. Good luck!

Member Avatar for Duoas
0
84
Member Avatar for camproject

In the combo box 'select item' event handler, use [URL="http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspx"]ShellExecute[/URL]() to start VLC with the name of the file to play as argument. You can use the returned process handle with [URL="http://msdn.microsoft.com/en-us/library/ms687032.aspx"]WaitForSingleObject[/URL]() (or any of the [B]wait[/B] functions) to wait for VLC to finish. Hope this helps.

Member Avatar for Duoas
0
81
Member Avatar for msupstream

Dog and Cat don't relate to each other, and should probably not be friends. (No joke intended, though it is funny anyway...) "Friends" in the C++ sense mean that some [i]foreign[/i] object has access to your object's internals. This is useful, and quite often, but should not be used indiscriminately. …

Member Avatar for Narue
0
156
Member Avatar for sarehu

[quote]Use only spaces, and indent 2 spaces at a time.[/quote] Yes! Vindication! Bwaa hah hah hah ha haah PS I don't like tabs.

Member Avatar for Nick Evan
1
147
Member Avatar for lahom

Do you mean that when you use the IDE to assign the icon to your application that the resulting EXE's icon is missing its transparency? It could be that the IDE is too old to handle alpha transparency (bit-transparency should work just fine). In which case you will have to …

Member Avatar for Duoas
0
123
Member Avatar for lahom

...but that is not guaranteed. It is [i]usually[/i] a safe bet that it contains at least the simple name of the executable ("foo.exe"). It may also contain either an absolute path or a relative path. On POSIX systems (Unix, Linux, Mac OS X, etc), use [URL="http://www.opengroup.org/onlinepubs/009695399/functions/getcwd.html"]getcwd[/URL]() and combine the result …

Member Avatar for Duoas
0
174
Member Avatar for death_oclock

Unfortunately what you are trying to do can't be done directly. The only time the sizeof/sizeof idiom works is on the original array[] variable. Pointers and function arguments etc don't know anything about the original array... The two usual solutions are: [list=1] [*]Pass the size of the array as an …

Member Avatar for death_oclock
0
192
Member Avatar for Thew

Nope. (Sorry.) [edit] I could be wrong. Someone might have made a hack to do this... It might be worth you while to ask over at the [URL="http://www.tek-tips.com/threadminder.cfm?pid=102"]Tek-Tips Delphi[/URL] forum.

Member Avatar for Duoas
0
28
Member Avatar for lahom

What do you mean by 'it returns the wrong answers'? How are you returning data from the console application?

Member Avatar for Duoas
0
208
Member Avatar for johnray31

To get a filename without path or extension you need to do some string manipulations. Here are three procs I use all the time (well, in C++... I haven't used C in a while): [code=C] #include <stdlib.h> #include <string.h> /* ExtractFilePath() * Returns a new string containing the directory information …

Member Avatar for Duoas
0
130
Member Avatar for HLA91

Here's a wild stab in the dark: you are using a really old compiler like Turbo C. If I'm right, then you should visit one of the following and get yourself a compiler that makes 32-bit executables: [url]http://www.mingw.org/[/url] [url]http://www.turboexplorer.com/[/url] [url]http://www.microsoft.com/express/vc/[/url] Hope this helps.

Member Avatar for HLA91
0
105
Member Avatar for mod_motox

You aren't erasing the [i]iterator[/i], you are erasing the [I]contents[/I] of your map. An iterator is practically always a locally-constructed variable, so you don't have to worry about destructing it. From your point of view (the programmer) you can consider an iterator the same as a pointer into a container …

Member Avatar for Duoas
0
174
Member Avatar for rickstar123

The "hex" file is really just a plain-vanilla text file. Each byte is represented by a two-digit hexadecimal value: 00..FF. The first number is the relative address of the first byte listed on that line. In the example you listed, the first byte listed on the first line is at …

Member Avatar for Duoas
0
2K
Member Avatar for Vallnerik25

You've got the general idea. The [inlinecode]%[/inlinecode] sign is the [b]modulo[/b] (or [b]remainder[/b]) operator. So what it is saying is: "If the number I am looking at ([B]trial[/B]) divides evenly by the indexed prime (which should have been written as [inlinecode]primes[ [B][/B]i[B][/B] ][/inlinecode] to be less confusing), then we have …

Member Avatar for Vallnerik25
0
504
Member Avatar for Graham_Saint

I know next to nothing about databases (because I [i]really don't like[/i] messing with them). But I wonder, being separate forms, are you using a separate connection to the database in each form? It sounds to me like the second form is trying to modify something that is locked by …

Member Avatar for Graham_Saint
0
301
Member Avatar for klay.martens

Every version of python I've ever gotten (including the last three) came with DLL files. [code] C:\WINDOWS\system32>dir python*.dll Volume in drive C is Ceres Volume Serial Number is 0000-0000 Directory of C:\WINDOWS\system32 02/08/2005 05:23 PM 979,005 python23.dll 10/18/2006 09:35 AM 1,871,872 python24.dll 02/21/2008 01:11 PM 2,117,632 python25.dll 3 File(s) 4,968,509 …

Member Avatar for klay.martens
0
169
Member Avatar for lkonitz

No. With some old BASICs you can play with the [B]SCREEN[/B] command to set the window mode, but GWBASIC doesn't understand anything but CGA modes... Also, the forum you want is [b]Legacy and Other Languages[/b]. Hope this helps.

Member Avatar for Duoas
0
100
Member Avatar for Brent.tc

I think by this point [b]AD[/b] is tired of answering the same question the same way again and again and again... If you want the machine code for the function, tell your compiler to output the assembly code, chop off everything except the function, and run it through your assembler, …

Member Avatar for Duoas
0
96
Member Avatar for Muttley

OK, since no one else is looking at this one... (I had to go learn to do the Matrix Chain Multiplication) I think you are missing something here. The MCM algorithm isn't actually supposed to [i]multiply[/i] the matrices together. It is just to tell you the best [i]order[/i] in which …

Member Avatar for Duoas
0
202
Member Avatar for integer*09

The [B]string[/B] class does have methods specifically for doing that sort of stuff. But you can use the standard algorithms just as easily. [code=C++] #include <algorithm> // needed by using_iterators() #include <cctype> // needed by using_iterators() #include <functional> // needed by using_iterators() #include <iostream> #include <iterator> // needed by using_iterators() …

Member Avatar for integer*09
0
339
Member Avatar for Shaun32887

There is no particularly 'easy' answer, but you can use the STL to do it: [code=C++] #include <algorithm> #include <iostream> #include <iterator> #include <sstream> #include <string> #include <deque> // Our dummy class template <int n> struct column_n_t: public std::string { }; // Our dummy class input extractor template <int n> …

Member Avatar for Shaun32887
0
212
Member Avatar for edman

Please use [[B][/B]code[B][/B]] tags. You've declared the [b]monthEnd[/b]() function as existing, but you don't appear to have defined it anywhere. If you prototype a function somewhere, there should be a corresponding function elsewhere. When you compile, make sure to turn as many warning messages on as you can. The compiler …

Member Avatar for edman
0
108
Member Avatar for Jennifer84

The best way to do that is to use a visual trick. Capture an image of the button. (You can do this by using [b]GetWindowDC[/b]() on your form, then using [b]BitBlt[/b]() to transfer the image of the button into a [b]TImage[/b] canvas.) Actually hide the button. In your form paint, …

Member Avatar for Jennifer84
0
146
Member Avatar for SGoel

You can't use Int 21h or any other DOS interrupt service unless DOS (or WinXP or earlier) is running --hence the reason it works in the emulator and not in real-life. The purpose of the OS is to manage software and provide access to hardware devices (such as disk drives). …

Member Avatar for SGoel
0
142

The End.