2,045 Posted Topics

Member Avatar for georgy9002

Make search_num return a bool, it'll make life easier. Be careful with lines like 46, just assign 0 instead. False might work, but it might not, I'm not sure. Look at lines 54-56 for one of the major sources of error. What you have done is declare 3 variables within …

Member Avatar for gio.perez13
0
153
Member Avatar for blackxswil

Where does j come from on line 66? In terms of what you are trying to do, at which step is it failing?

Member Avatar for jonsca
0
121
Member Avatar for gpjacks

Look into the [icode] .push_back() [/icode] method of the vector as well. Otherwise you are treating your vectors like arrays and they have so much more power than that.

Member Avatar for gpjacks
0
266
Member Avatar for tech9x

[url]http://www.cplusplus.com/reference/clibrary/cstdlib/strtol/[/url] Note that it takes a C-string (so if you're using std::string you need to use the [icode] .c_str() [/icode] method)

Member Avatar for WaltP
0
74
Member Avatar for muze

Can you post this portion of your code? You are probably trying to call a function that is not declared.

Member Avatar for jonsca
0
186
Member Avatar for Violet_82

You need to use the functions in iomanip. The decimals are there, they are just not being displayed. So, [icode]#include <iomanip> [/icode] and see [url]http://www.cplusplus.com/reference/iostream/manipulators/setprecision/[/url] . You'll have to set the fixed setting first like they do in the example.

Member Avatar for Violet_82
0
185
Member Avatar for johnloiebert

Please post the code that you tried or a subsequent attempt without using switch (as neither one requires it per se).

Member Avatar for jonsca
-1
140
Member Avatar for flide
Member Avatar for jonsca
0
33
Member Avatar for muthu1802

AD's got it I think: [url]http://www.daniweb.com/forums/post1395916.html#post1395916[/url] (OP double posted this) The problem is, the order of which the ++ and + will happen is implementation dependent.

Member Avatar for Fbody
0
93
Member Avatar for jasleen12345

You want to include <cstring> (which is the old string.h from C that has strcpy, etc) instead of <string>. As you have it now, you are including <string> which has a class named std::string, which is probably causing a name collision.

Member Avatar for wickedflo
0
132
Member Avatar for halopower67

Ask the user for a starting coordinate (row, column), orientation (horizontal or vertical), and size of ship. Make sure the ship will fit in the area (i.e., isn't too long in one dimension or isn't already taken up by another ship). Change the value of the board at the appropriate …

Member Avatar for invisal
0
122
Member Avatar for Kakashi Hatake

Evidently there's a configuration option that needs to be set (see [url]http://davis.lbl.gov/Manuals/GDB/gdb_21.html[/url] at the top of the page)

Member Avatar for Kakashi Hatake
0
2K
Member Avatar for kuchick32

At least make some attempt at the StringModify methods first. Just posting the skeleton provided by your instructor isn't sufficient.

Member Avatar for jonsca
0
119
Member Avatar for Martje

I tried a few things, but I didn't come up with a solution. I don't use this date format on my machine so I couldn't test it fully anyway. You could always use the [icode] dateTimePicker1->Value = DateTime(year, month, day); [/icode] overload (where those are ints), but I'm not sure …

Member Avatar for Martje
0
80
Member Avatar for pgr_DW808

You never use the i from your for loop in the calculation. You should use that value to calculate the monthlyInterestRate inside of the loop.

Member Avatar for pgr_DW808
0
117
Member Avatar for SVSU_Student

[icode]for(index = 0; index < score_length; index++);[/icode] Something is amiss on that line. Check the end of it. Doing this causes the for loop to run score_length number of times with ";" as the line to be looped over. You may want to pass the number of elements in the …

Member Avatar for jonsca
0
223
Member Avatar for bookmark

In the second one, length is a method of the string class, so therefore you call it on s directly, like [icode] s.length() [/icode]

Member Avatar for alaa sam
0
153
Member Avatar for Spiffy P Mcgee

Nothing that I can see. What is the result you are expecting? (note that you don't have a newline after your cout, so your numbers are all crammed together.

Member Avatar for jonsca
0
143
Member Avatar for natha_peepli

[QUOTE=Ancient Dragon] In the constructor you need to allocate memory for the array [icode]vector = new float[x];[/icode] [/QUOTE] Where have you done this step that AD indicated?

Member Avatar for natha_peepli
0
170
Member Avatar for The Dude

And I made jwenting say that with my Jedi powers (forget anything scientific). The test was too obvious the way it was laid out (still my score was just about "e" which gives some logarithmic significance to my answers).

Member Avatar for The Dude
0
140
Member Avatar for KellieD

Your function does not belong in the middle of main [code] #include <iostream> using namespace std; int SumN(your parameters here); //function prototype int main() { } int SumN(your parameters here) //function definition { } [/code] Note you can put your function definition where you function prototype is and forgo the …

Member Avatar for SgtMe
0
153
Member Avatar for javac++

[QUOTE=gerard4143]O.K. What do you have so far?[/QUOTE] Agreed. @OP - what system or API are you using to get the mouse coordinates? Win32API? something proprietary?

Member Avatar for jonsca
-1
71
Member Avatar for purohiti
Member Avatar for jonsca
0
86
Member Avatar for darkagn

My similar issue had cleared up and has remained clear for months, despite having reported posts in the meantime. I thought you'd updated/cleared the cache on the server(s) to pull it off, Dani (I may be wrong as I know nothing of that fun). You can celebrate both times you …

Member Avatar for jonsca
0
150
Member Avatar for MasterMic

I'm not certain what the exact problem with your program is, but Dev-C++ is no longer in development, so the one that you can download will almost certainly have an older version of Mingw (Windows port of gcc/g++). That should mean that some portions of your program should run more …

Member Avatar for MasterMic
0
226
Member Avatar for bookmark

[icode]main()[/icode] is never void, it always returns an int according to the standard. As to your actual problem, you are mixing up the syntax for printf (the function in the C standard library) with the syntax for cout. Look up the syntax for cout (or find one of countless examples …

Member Avatar for natha_peepli
0
102
Member Avatar for MasterGberry

Get rid of the [icode] 'q' != [/icode] part and test whether str is equal to q before line 21. If it is, break out of the loop. That's probably the most straightforward way to to do it.

Member Avatar for MasterGberry
0
133
Member Avatar for barevhayerable

I can't tell if this is all you are looking for (as you posted a boatload of other stuff) but check out [url]http://www.daniweb.com/forums/post9554.html#post9554[/url] and scroll about 1/4 page down and that will tell you how to get a number within a range. [quote]To be implemented by contestant: player.c or player.cpp …

Member Avatar for arkoenig
0
349
Member Avatar for mphan228

It shouldn't all be crammed into main() like your code example, according to your assignment. Your main() will have your variable declarations and other such housekeeping, but it will be closer to what you put forth in your "Ex".

Member Avatar for jonsca
0
381
Member Avatar for yuugib

It's s bit confusing, but it seems to be asking you to apply sumN() to each element of your array. This would be a good spot to use a loop over each of the #size inputs. Keep it in main() and model it after your input loop.

Member Avatar for penguins10
0
565
Member Avatar for Hayzam_#include

You can train a dog to paw the keys on a typewriter, that doesn't mean it can write a novel or care what it's doing for that matter.

Member Avatar for jonsca
-2
178
Member Avatar for shanebond

Take a look at something like [url]http://www.sorting-algorithms.com/[/url] to get the gist of the sorting algorithms. Give at least one or two of them a try (with code, we don't provide code, that's your job) and post back. Bubble is probably the most intuitive, so start with that one, swap elements …

Member Avatar for peter_budo
-1
716
Member Avatar for barevhayerable

Hint: if you don't want to use gdb either grab an IDE that supports it (like code::blocks or Eclipse) or do the poor man's debugger and strategically place some cout statements throughout your code (with labels, so you know where you are) to view intermediate values.

Member Avatar for jonsca
0
92
Member Avatar for madilexi

Regardless of whether or not it is found, your results section is going to output for the current k, so if k=0, you're going to get index 0 from your other arrays. Some p-code: [code] Input the ID For loop (over all the ids) If it exists, note the index …

Member Avatar for jonsca
0
140
Member Avatar for Bri426

Sort the two arrays in parallel (every move you make on the scores array, make on the names array so they will line up). Go through a sort by hand and translate those steps involved into a set of loops that will do the same thing. A bubble sort will …

Member Avatar for jonsca
0
150
Member Avatar for hzp

Take 62 to 73 out of the loop so they won't display for each character you are checking.

Member Avatar for jonsca
0
136
Member Avatar for TSims11

See if using [icode] this->Hide() [/icode] on line 5 gives you the effect that you want. Your first dialog will still be in memory. Unless your dialog has lots of controls on it, this shouldn't be a problem. I think this has something to do with the fact that the …

Member Avatar for TSims11
0
277
Member Avatar for treger69

Ask yourself these questions...How are you getting repeated numbers without a loop? What makes your program run through a second time? Pretend you are the computer executing your program, write out what the values are at each step.

Member Avatar for Software guy
0
91
Member Avatar for malayasthana

Please use code tags: [noparse][code]//code goes here[/code][/noparse] Change dirpath to a [icode] std::wstring [/icode] and in the open operations use [icode] dirpath.c_str()[/icode] instead of dirpath, since you need a C style string (null terminated) in that particular function. Using the c_str() method on the wstring gives you the [icode] const …

Member Avatar for jonsca
0
132
Member Avatar for tKc

I'm confused by your use of double on the function prototype (which is ok where it is, but is usually placed before main instead of on line 6) and void in the definition. You seem to be expecting it to return a double (again, not sure why you want to …

Member Avatar for tKc
0
164
Member Avatar for dnambembe

Please use code tags `[code]//code goes here [/code]` In your `GetString()` function, add a `cin.ignore()` after the cin.get. There's probably a stray '\n' in the stream which gets picked up by the cin call in the `GetNumber()` function.

Member Avatar for dnambembe
0
1K
Member Avatar for serkan sendur

Really you'd remember "to" and then "en" and then "em" and then in a shocking twist you'd remember "M." That and for you, you'd have #include <stdio.h> tattooed on your arm and not remember why. [QUOTE=jephthah;1185382]I don't know why, but every time i see this thread title [I]Memento [/I]comes to …

Member Avatar for ronnieaka
0
1K
Member Avatar for cppgangster
Member Avatar for BestJewSinceJC

Is it similar to this thread's problem? [url]http://www.daniweb.com/forums/post1340978.html#post1340978[/url] I think Dani had to go to the ad vendor, so it might help if you told her which ad it was.

Member Avatar for Dani
0
53
Member Avatar for AndreRet

In celebration, I'm going to pour myself a tall glass of "who the hell cares." :D

Member Avatar for WASDted
2
157
Member Avatar for burcin erek

You can't return more than one value. Pass in your second variable by reference: [icode] string takerecord(string & surname) { //set surname equal to surname1 and return name1 }[/icode]

Member Avatar for jonsca
0
102
Member Avatar for wrhurst

Please use [noparse][code]//code goes here[/code][/noparse] (code tags) to maintain the formatting of your code when you post it. What are the errors that you are getting? Try to consolidate your code inside your for loop down to just a couple of lines. Hint: [icode] myStudents[counter] == "Andy" [/icode] resolves to …

Member Avatar for wrhurst
0
170
Member Avatar for ChaosKnight11

@evstevemd - the OP is working with .NET so an unmanaged library like that would require marshaling between the unmanaged and managed layers @OP - You should be able to use the C# library in your C++/CLI code. The intellisense in 2010 is crappy for C++/CLI but see what happens …

Member Avatar for Stefano Mtangoo
0
325
Member Avatar for knifty09

Can you post a couple of lines of your data file? Your code resembles C more than C++ (other than the fact that you included iostream).

Member Avatar for jonsca
0
106
Member Avatar for Martje

Use the BackgroundImageLayout property [icode] pictureBox1->BackgroundImageLayout = ImageLayout::Stretch; [/icode] (then, once you resize the PB, the image should stretch with it)

Member Avatar for Milton Neal
0
2K

The End.