1,174 Posted Topics

Member Avatar for maddav

Your [ICODE]duplicate()[/ICODE] methods are consistently wrong. Instead of passing an address of an object on stack like you do, allocate the object from the heap using [ICODE]new[/ICODE] and return the pointer to it. For example .. [code] shape *duplicate() { return new square(length); } [/code] And once you've done with …

Member Avatar for maddav
0
628
Member Avatar for green_frog

By leaving the nullified pointers in the vectors, the second time around you iterate over the vectors, a crash is more than likely to happen (assuming these indices remain NULL pointers). Also you may want to check what the destructors are doing. [EDIT] Oh, and please read [URL="http://www.daniweb.com/forums/misc-explaincode.html?TB_iframe=true&height=400&width=680"]What are code …

Member Avatar for mitrmkar
0
162
Member Avatar for M_SOLAIMAN

Are you aware of (all) the [URL="http://msdn.microsoft.com/en-us/library/cc144200%28VS.85%29.aspx"]autorun.inf entries[/URL] and what you can do with them. I'm not 100% sure, but I think you might very well do without any extra compiled executable on the CD. If you still think you need this executable, what exactly would this executable do? Ancient …

Member Avatar for mitrmkar
-2
152
Member Avatar for mariosbikos

[QUOTE=mariosbikos;1199292] in my mind my code is right but windows say no.....[/QUOTE] You want to check your [URL="http://www.cplusplus.com/reference/clibrary/cstdio/scanf/"]scanf()[/URL] usage. Most of them seem to be right but some are dangerously wrong. For example; [code] // A single char char apantisi; ... // '%s' expects an array of char (i.e. a …

Member Avatar for mariosbikos
0
276
Member Avatar for Duki

Your compiler may have a [I]verbose[/I] option (i.e. some switch), which would enable you to see where it is actually looking for the include files.

Member Avatar for Fbody
0
560
Member Avatar for lotrsimp12345

You cannot a pass an iterator to [URL="http://www.cplusplus.com/reference/stl/vector/at/"]at()[/URL]. Read up about its parameter.

Member Avatar for lotrsimp12345
0
249
Member Avatar for kamos.jura

I think the [COLOR="Red"]trouble is[/COLOR] due to [ICODE][COLOR="Red"]const[/COLOR] vector<double> &GetData()[/ICODE].

Member Avatar for kamos.jura
0
245
Member Avatar for PTRMAN1

[QUOTE=PTRMAN1;1204228]the output program at the end is blank.[/QUOTE] The input file is not opened? You might use [ICODE].is_open()[/ICODE] to check that.

Member Avatar for PTRMAN1
0
173
Member Avatar for SacredFootball

[QUOTE=SacredFootball;1204249]what the heck is going on?[/QUOTE] [code] cout << "Your score is: " + finalPoints_ [/code] You want to change the '+' there to something else.

Member Avatar for SacredFootball
0
110
Member Avatar for SacredFootball

[quote] SOLVED IT!: added fflush(stdin); [/quote] Oh no, perhaps reconsider and find another solution to the problem, read e.g. [URL="http://www.gidnetwork.com/b-57.html"]Things to Avoid in C/C++ -- fflush(stdin)[/URL]

Member Avatar for mitrmkar
0
18K
Member Avatar for skorm909

One basic Windows tutorial is [URL="http://www.winprog.org/tutorial/"]theForger's Win32 API Tutorial[/URL]

Member Avatar for mitrmkar
0
84
Member Avatar for Twonk

In the derived constructors, you want to to pass the [ICODE]pID[/ICODE] to the base class.

Member Avatar for Twonk
0
113
Member Avatar for aae005

[QUOTE=aae005;1203764]i am new at c++ so plz help me to solve this home work i need marks plz [/QUOTE] You should be paying more attention to the assignment. You are required to write C programs (not C++). You might also read [URL="http://www.daniweb.com/forums/announcement8-2.html"]We only give homework help to those who show …

Member Avatar for mitrmkar
-2
137
Member Avatar for NitaB

Introduce a new scope {} inside the case, like so .. [code] switch (service) { case 'D' : { // new scope begins .. ... your code here as is ... } // .. and ends case ... [/code]

Member Avatar for NitaB
0
1K
Member Avatar for vbx_wx

Line #12, [ICODE]subhkey[/ICODE] would be used uninitialized at that point, even if your class declares a member: [ICODE]HKEY subhkey[/ICODE]. Then, are you sure you posted the actual code, I think, [ICODE]open_key(hkey[/ICODE] should rather read [ICODE]open_key(hKey[/ICODE]? >> but what he does is enumerate twice the subkeys of the HKEY_CURRENT_USER Perhaps post …

Member Avatar for mitrmkar
0
958
Member Avatar for mebob

[QUOTE=mebob;1192996]I ran it in debug mode, and it said there was a segfault. When it told me where the error was, it was in the ostream header file. Now what do i do?[/QUOTE] At least one out-of-bounds (13 vs. 28) write .. [code] float percent[13]; ... for ( i = …

Member Avatar for mebob
0
161
Member Avatar for doolsta111

Looks like you are doing something like [code] ifstream ifs("foobar"); char chr[1]; // Read a char ifs.get(chr); [/code] Just change to plain char, i.e. [code] ifstream ifs("foobar"); char chr; // Read a char ifs.get(chr); [/code]

Member Avatar for mitrmkar
0
245
Member Avatar for smoothe19

[QUOTE=Sir Saula;1199327]It does work but when the word is being read from a file and then passed into that method it does not properly remove the [I]punctuation[/I].[/QUOTE] Looking at the code you've posted (post #6), I notice that you've removed the following line .. [code] x.erase(std::remove_if(x.begin(), x.end(), &ispunct), x.end()); [/code] …

Member Avatar for mitrmkar
0
5K
Member Avatar for riahc3

An additional thing that looks real bad and may be contributing to your problems .. [code] fflush(stdin); [/code] you might read [URL="http://www.cprogramming.com/faq/cgi-bin/smartfaq.cgi?answer=1052863818&id=1043284351"]Why fflush(stdin) is wrong[/URL].

Member Avatar for jephthah
0
203
Member Avatar for dragontruong
Member Avatar for mitrmkar
0
159
Member Avatar for hellskier

Line #115, should it rather read [code] case 3: ofBB.push_back(row[COLOR="Red"]b[/COLOR][jb]);break; [/code]

Member Avatar for hellskier
0
178
Member Avatar for gufur

The code you've posted will not even compile (snippet #1/line #11). So, maybe post the exact code that you are actually using.

Member Avatar for gufur
0
402
Member Avatar for K0ns3rv

Consider the following .. [CODE] struct foo { float f1, f2, f3; // Accept a pointer to an array of 3 floats foo(float (*f)[3]) { f1 = (*f)[0]; f2 = (*f)[1]; f3 = (*f)[2]; } private: // Hide the unsafe constructor foo(float *); }; // And use it like .. …

Member Avatar for K0ns3rv
0
122
Member Avatar for tarheelfan_08

>> for some reason when i run it the command prompt appears blank. You have forgotten to use [ICODE]account_details()[/ICODE].

Member Avatar for tarheelfan_08
0
213
Member Avatar for tarheelfan_08

[QUOTE=tarheelfan_08;1190038]What do you mean, my CarList stuff is after my car class set up..is this incorrect??[/QUOTE] At the moment, your [ICODE]CarList[/ICODE] only has a constructor defined, all member methods (e.g. [ICODE]void insert(Car)[/ICODE]) lack the implementation (or you haven't posted all of the code). Then a thing that is quite wrong …

Member Avatar for tarheelfan_08
0
2K
Member Avatar for yznk

Lines 31 and 33 are assignments instead of comparisons. PS. In the future, try to be much more detailed than just stating "code is not working".

Member Avatar for yznk
0
115
Member Avatar for CppBuilder2006

[QUOTE]MRKtack.exe!VisualEditBox::LineMinMax+0x6a MRKtack.exe!VisualEditBox::Refresh+0x7e MRKtack.exe!VisualEditBox::InternalPaint+0x3b MRKtack.exe!SelectEditBox::MouseSetCaret+0x242 MRKtack.exe!UndoEditBox::MouseSetCaret+0x14a MRKtack.exe!SelectEditBox::StartSelection+0x40 MRKtack.exe!EditBox::wmLbuttondown+0x130 MRKtack.exe!WndProc+0x2bd USER32.dll!UserCallWinProc+0x18 USER32.dll!DispatchMessageWorker+0x2e4 USER32.dll!DispatchMessageW+0xb MRKtack.exe!Window::MessageLoop+0x5f MRKtack.exe!Window::Run+0x2b MRKtack.exe!WinMain+0x82d MRKtack.exe!__tmainCRTStartup+0x286 MRKtack.exe!WinMainCRTStartup+0xd KERNEL32.dll!BaseProcessStart+0x3d[/QUOTE] To point out at least one immediate problem, it gets 'stuck' in the [ICODE]LineMinMax()[/ICODE] doing some lengthy calculations there. When it stops responding, break it into the debugger and watch the values being …

Member Avatar for CppBuilder2006
0
152
Member Avatar for thriek

I don't know much about SDL programs' behaviour and possibilities, but I noticed that you do a [ICODE]exit(0);[/ICODE] there (line #50). In practice, no code that you have below that line will get executed, see [URL="http://www.cplusplus.com/reference/clibrary/cstdlib/exit/"]exit()[/URL]. Perhaps you should find a SDL forum for SDL-specific questions.

Member Avatar for thriek
0
411
Member Avatar for tallygal

Both of your [ICODE]for()[/ICODE] loops end with a semicolon, that's a huge problem. Delete those semicolons and see how it changes the outcome.

Member Avatar for WaltP
0
206
Member Avatar for adams161

Try the following, in the dialog box's [icode]OnInitDialog()[/icode] handler .. [code] CDialog::OnInitDialog(); SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); [/code] [QUOTE] Additionally if there was a way it could [I]always be on top of other programs but still be minimized[/I], that would be even better.[/QUOTE] Sorry, but I don't quite understand …

Member Avatar for adams161
0
130
Member Avatar for Wert1

Somewhat off-topic, only related to this zero-length thing, here is Herb Sutter's take on it [URL="http://herbsutter.com/2009/09/02/when-is-a-zero-length-array-okay/"]When is a zero-length array okay?[/URL]

Member Avatar for mitrmkar
0
345
Member Avatar for pramoda.ma
Member Avatar for kedarm

Considering using [ICODE]fflush()[/ICODE] to have the output printed immediately [CODE] fprintf(stdout,"Hey guys.."); /* force the output onto the screen .. */ fflush(stdout); struct timespec t_req, t_rem; t_req.tv_sec = 1; t_req.tv_nsec = 500; if (nanosleep(&t_req, &t_rem) < 0) return 0; fprintf(stdout,"...What's up?");[/CODE]

Member Avatar for mitrmkar
0
955
Member Avatar for spetsnaz26

You might use a [URL="http://www.cplusplus.com/reference/iostream/stringstream/"]stringstream[/URL] for that purpose. This has been answered probably a gazillion times, here we go again .. [code] #include <iostream> #include <string> #include <sstream> int main() { std::string filename ("data"); std::string extension (".txt"); std::stringstream sstrm; for(int X=1;X<11;X++) { sstrm << filename << X << extension; std::cout …

Member Avatar for spetsnaz26
0
255
Member Avatar for pinsickle
Member Avatar for bandit711

[QUOTE=bandit711;1186732]i come up with a additional set of numbers, but i don't know why.[/QUOTE] Line #44 needs rewriting [code] while(inFile) [/code] Change it to .. [code] while(inFile >> studentName >> quiz1 >> quiz2 >> quiz3 >> quiz4) { // rest of the code ... } [/code] Your [ICODE]while(inFile)[/ICODE] is a …

Member Avatar for bandit711
0
165
Member Avatar for xofth

[QUOTE=xofth;1185903]my question is still there that how can i place check on the input that user can enter only 'y' or 'n'[/QUOTE] Consider using logical AND (&&) .. [code] do { prompt the user .. get the input .. } while(ans != 'y' && ans != 'n'); [/code] or logical …

Member Avatar for xofth
0
223
Member Avatar for vbx_wx

You need to use the [ICODE]KEY_ENUMERATE_SUB_KEYS[/ICODE] flag when opening the key .. [CODE] // .. if(RegOpenKeyEx( HKEY_CURRENT_USER , "Software" , 0 , KEY_ENUMERATE_SUB_KEYS | KEY_QUERY_VALUE, &hkey) == ERROR_SUCCESS) { // .. [/code] Note that a successful [ICODE]RegEnumKeyEx()[/ICODE] call will change the value of the [ICODE]size[/ICODE] parameter to be the length …

Member Avatar for vbx_wx
0
124
Member Avatar for vbx_wx

See the documentation on [URL="http://msdn.microsoft.com/en-us/library/aa384702%28VS.85%29.aspx"]InternetGetConnectedState()[/URL] The first parameter is a[I] pointer to a DWORD[/I] (i.e. [I]LPDWORD[/I]), which receives one or more of the flags, as described. So, rather use .. [code] DWORD dwFlags; BOOL bState = InternetGetConnectedState(&dwFlags, 0); // .. check the state + the flags [/code] It seems to …

Member Avatar for mitrmkar
0
2K
Member Avatar for theABCasian

[QUOTE=theABCasian;1180647]should be initialized in constructor[/QUOTE] I think you are still missing the point that jonsca has been making about [I]static[/I] member variables, perhaps see C++FAQ [URL="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.10"] [10.10] Why can't I initialize my static member data in my constructor's initialization list?[/URL], and read the next one [10.11] too.

Member Avatar for mitrmkar
0
172
Member Avatar for vegaseat

Adding to what's been said, just in case anyone is interested in trying out the code. This [code] printf("Enter name (ENTER only will exit) : "); scanf("%s",str); [/code] will not work as intended, i.e. just pressing ENTER without any other input does not make [ICODE]scanf()[/ICODE] return. With the original [ICODE]gets()[/ICODE] …

Member Avatar for mitrmkar
2
232
Member Avatar for spursfan2110

[QUOTE=spursfan2110;1175597]Actually, to be more specific, it appears to happen immediately before the free(cur) would be executed...which seems even odder to me.[/QUOTE] Likely you are [I]writing to already freed memory[/I], outside this [ICODE]delete_from_list()[/ICODE] function. The debug memory management facilities kick in upon the attempt to [ICODE]free()[/ICODE], catching the aforementioned error (-> …

Member Avatar for spursfan2110
0
2K
Member Avatar for mucoool

[QUOTE=mucoool;1172780]char text[10][/QUOTE] You need to increase the size of that array by one, if you intend to copy a literal such as "0x00000000" into it (you must account for the terminating '\0' character). Otherwise, you'll be writing out of bounds, which is not allowed. PS. Maybe consider using [ICODE]std::string[/ICODE]s instead …

Member Avatar for jonsca
0
284
Member Avatar for tyliang

Consider switching to [ICODE]unsigned char[/ICODE]s altogether, or at the minimum, cast to [ICODE]unsigned char[/ICODE] whatever you pass to [ICODE]isdigit()[/ICODE]. PS. When you post code/error messages, please tick the "Disable smilies in text" option before you post (see your second post ^^).

Member Avatar for mitrmkar
0
250
Member Avatar for khan001

[QUOTE=urbangeek;1173997]correct me if i'm wrong [CODE] double celsius; printf("%[COLOR="red"]lf[/COLOR] temperature in celsius",celsius); [/CODE][/QUOTE] I think it was Dave Sinkula who once corrected me about this printf/double and %[COLOR="Red"]l[/COLOR]f. That line should rather read .. [code] printf("%f temperature in celsius", celsius); [/code] In C99, the [ICODE]printf("%[COLOR="Red"]l[/COLOR]f")[/ICODE] should have no effect, though …

Member Avatar for mitrmkar
0
143
Member Avatar for mrnobody

[QUOTE=mrnobody;1171904] If I use OnCtrlColour handler, when is the function called..? Is it everytime the the dialog is reload/refresh or is it continuously called independent of what I do..?[/QUOTE] MSDN says; "The framework calls this member function when a child control is about to be drawn." In practice, this means …

Member Avatar for mrnobody
0
2K
Member Avatar for Saabrina

If you already haven't, then try debugging the constructor, that is, place a breakpoint at the following line and take it from there .. [code] TextureName = strlwr(strdup(Filename)); [/code]

Member Avatar for Saabrina
0
125
Member Avatar for tallygal

[QUOTE=tallygal;1170780]Thanks... I changed it to this, but it still [I]is not reading the if statements[/I][/QUOTE] You are using uninitialized variables local to the functions, consider the following ... [code] void decline () { char letter, // <- A local variable, uninitialized status; // <- A local variable, uninitialized // See …

Member Avatar for tallygal
0
269
Member Avatar for Pynolathgeen

[QUOTE=Pynolathgeen;1171525] [code=C++] Oldproc = (PROC)SetWindowLong(Childs[1], GWL_WNDPROC, (DWORD)EditProc); [/code][/QUOTE] You might want to check that [ICODE]SetWindowLong()[/ICODE] actually succeeds. And while you are at it, you might switch to [URL="http://msdn.microsoft.com/en-us/library/ms644898(VS.85).aspx"]SetWindowLongPtr()[/URL] altogether (it supersedes the former).

Member Avatar for tetron
0
131
Member Avatar for Buttacup

Have you considered using STL containers instead? Such as [URL="http://www.cplusplus.com/reference/stl/vector/"]vector[/URL]<ICOMInterface*> or [URL="http://www.cplusplus.com/reference/stl/list/"]list[/URL]<ICOMInterface*> for example.

Member Avatar for Buttacup
0
133

The End.