364 Posted Topics

Member Avatar for misterious

This might be useful to you: [url]http://www.google.com/search?q=what+is+the+answer+to+my+homework%3F[/url] </sarcasm>

Member Avatar for raptr_dflo
-4
137
Member Avatar for airerdem

At line 12 of your code, you wrote "I don't know that part" (sorry, the line numbers won't match up here): [CODE] while((entry = readdir(dp))) { ... I don't know that part } [/CODE] The responder provided code that solves your problem, specifically at line 21: [CODE] while ((dirp = …

Member Avatar for raptr_dflo
0
257
Member Avatar for ryamjones

Ryamjones, If you haven't discovered it yet, the code (as you posted it) has an extra right-brace at line 35 or 36. But that would cause a compile-time error. As has been suggested in several other threads here, consider using [ICODE]getline()[/ICODE] to read each line from your input into a …

Member Avatar for raptr_dflo
0
156
Member Avatar for ztdep

It would greatly improve readability if you used consistent indentation in your code. That said, one very likely problem is the usage of mapface.erase() within the loop of the iterator over items in mapface. Since you pick your range of elements from mapface as the first N with the same …

Member Avatar for ztdep
0
129
Member Avatar for daino

You could certainly use a SQL database. There's no real concept of a C++ d'base, specifically. Instead, you might just want to start with reading/writing a simple text file, as murnesty suggested -- one line per row in your table, and elements in the row separated by comma (or any …

Member Avatar for raptr_dflo
0
231
Member Avatar for sadsdw

It looks to me like your output so far is correct. The "map" type isn't going to help you with your task, it just provides a space-efficient way of storing an indexed list of objects. Instead, you will want to traverse the tree structure you've built up. Specifically, for parents …

Member Avatar for sadsdw
0
779
Member Avatar for thecoolman5

As has been discussed in many other threads here, "cin >>" doesn't remove the end-of-line from the stream after you read in the zero or one. So I'm thinking the getline() at line 21 gets the now-empty line and writes it to the file, rather than waiting for a new …

Member Avatar for raptr_dflo
0
2K
Member Avatar for eman 22

[QUOTE=Ancient Dragon;1580070]That makes no sense. If T is type double how is the function supposed to convert the double to a single ascii character???[/QUOTE] Um, presumably by taking the modulo of the integer part against parameter [ICODE]size[/ICODE], which would presumably be 256 in this case? ;) Not saying it makes …

Member Avatar for m4ster_r0shi
0
614
Member Avatar for divineelite

For what it's worth, I'm running Vista and Windows 7 here (on separate laptops), and each has a "Manage Wireless Networks" item, rather than "View Wireless Networks". Also each has a vastly superior manufacturer-provided interface: "Dell Wireless WLAN Card Utility" and (untitled custom-chromed window, accessed via "Lenovo's Internet Connection" link …

Member Avatar for divineelite
0
204
Member Avatar for tow3lie

Well, since you know how to solve the problem for 4 and 6 disks, think about what are the legal and illegal moves, from the current state, and especially which pairs of moves make no sense (moving a disk from A to B and back to A accomplishes nothing). To …

Member Avatar for MareoRaft
0
186
Member Avatar for eng hassan

In prey::breed(), you check whether moves==3, but you don't reset it to zero, so that prey instance will never breed again. You probably have similiar problems in the other methods. While I was looking I also noticed that you randomly place prey and predators in the constructors, but don't check …

Member Avatar for raptr_dflo
0
1K
Member Avatar for jbennet

Right near the bottom, you're looping for 5 seconds, but do you have 5 seconds worth of audio in your .wav file to read in? Probably, it's only 5 seconds.... Also, from your earlier question, you're still reading audio data from stdin ... how are you getting the data out …

Member Avatar for raptr_dflo
0
3K
Member Avatar for kumarmpk4u

The error is occurring because CWnd::Attach() is requiring an internal window-handle object to be NULL ... that is, presumably, not already initialized in some other way. I suspect your problem may be that you're calling pMainFrame->LoadFrame() more than once (maybe inside a loop?), or possibly making some other call that …

Member Avatar for raptr_dflo
0
879
Member Avatar for FiToKa

A couple of additional tips: For your own sanity, consider using the C++ string type instead of character-arrays: [CODE] #include <string> ... std::string str; [/CODE] Also, there's nothing in your Deque class to indicate how the [b]nodes[/b] in your queue are connected to each other, or how the [b]deque[/b] keeps …

Member Avatar for FiToKa
0
138
Member Avatar for dgreene1210

At lines 20-27, you've already declared the return-types and argument types of the functions (up at the very top of your program). Now you just need to call the functions and capture the return types, for example: [CODE] greeting(); getInput(); int result = calculate(num1, num2, num3, num4); ... [/CODE] Also, …

Member Avatar for raptr_dflo
0
172
Member Avatar for gil_mo

If you're storing credit-card numbers, you may also want to encrypt the data (or the entire XML file) in addition to signing it. ;) As far as generating public and private keys, I recommend PuTTY: [url]http://www.chiark.greenend.org.uk/~sgtatham/putty/[/url]

Member Avatar for raptr_dflo
0
279
Member Avatar for localp

DLLs require Windows-specific declarations on each function you want to have accessible. As far as I know, these extra declarations do not impact your ability to access the functions if built into an .exe: [CODE] int someFunction(int someArgument) { ... } [/CODE] becomes [CODE] extern "C" __declspec(dllexport) int someFunction(int someArgument) …

Member Avatar for raptr_dflo
0
165
Member Avatar for yobbko

Yes. See moschops' response previously. If you want a useful answer, please ask the correct question. And demonstrate that you've tried to solve the problem yourself before asking us how to do everything. If DDE Server is to be part of your program, I don't know anything about its API, …

Member Avatar for raptr_dflo
0
948
Member Avatar for mahmoz

Break your problem up into small easily-managed pieces. You're off to a good start, you can create an empty grid, and you can print out your grid. What do you want to do next? Programming can seem overwhelming if you're trying to solve everything all in one step. Pick a …

Member Avatar for raptr_dflo
0
280
Member Avatar for massivefermion

If you're creating your own vector template class, then the forward declaration is: [CODE] template <class T> class vector; [/CODE] And depending on your compiler, the entire source for the template class may need to be included into the same file (specifically, you may not be able to separate the …

Member Avatar for raptr_dflo
0
2K
Member Avatar for infiniteloop56

Why does your ExpPow function ignore the "count" argument? Start there, and think about what it really needs to compute. Then think about your negexp function: how does the result of a negative exponent compare to the corresponding positive exponent? Can you make use of that by having one function …

Member Avatar for raptr_dflo
0
232
Member Avatar for George91340

Also, your input data file already tells you which row and which seat each person is in. Since you have that information, you might want to create a new array of seats, where each person is placed in the correct position: [CODE] Person *seats[10][3]; // TODO: initialize to NULL values …

Member Avatar for raptr_dflo
0
371
Member Avatar for colts18

pseudocode: [CODE] simulation_loop: new_time = old_time + time_step new_tank_pos = ComputeTankPos(tank_velocity, new_time) if new_tank_pos is too close to wall, other tank, whatever else: new_tank_pos = old_tank_pos tank_velocity = (0, 0) # if you have velocity separated into x and y components [/CODE]

Member Avatar for raptr_dflo
-1
473
Member Avatar for HelloPeople1

You've already clearly explained (in English) what you need to do, now translate that into code. pseudo-code here: [CODE] for enemy in enemies: is_wall = determine if there is a wall between enemy and me if is_wall: # do nothing continue dist = compute distance between enemy and me if …

Member Avatar for raptr_dflo
0
317
Member Avatar for jarograv

Your problem is that once you remove the shortest distance from your [ICODE]distances[/ICODE] array, when you search for the next-smallest distance, the index matches your cities list only if it comes before the previous one. If it comes after, you're looking at the wrong city. I think you can fix …

Member Avatar for TrustyTony
0
101
Member Avatar for hisan

We (or I, anyway) still don't really understand what it is you're trying to achieve. If you could include a small sample .csv file that you generate using your code, and then show us what you think it should look like instead, rather than speaking in abstractions, maybe that would …

Member Avatar for raptr_dflo
0
5K
Member Avatar for hisan
Member Avatar for raptr_dflo
0
213
Member Avatar for thierrypin

Since your sender-code reads the DACT objects out of a file, and then sends them to the receiver, you should be able to save received DACT objects into a new file (whenever you receive a complete one). When you finish, you can just 'diff' the two files, and that will …

Member Avatar for thierrypin
0
190
Member Avatar for Mr. K

Are you pressing the arrow keys? Your logic for moving the ball requires that a key be pressed to move the ball in that direction. I suppose the clock() will eventually wrap around, so you need to understand what the maximum value of clock() could be and handle it: [CODE] …

Member Avatar for raptr_dflo
0
107
Member Avatar for ben1996123

Consider what the following might do: [CODE] char letter = 'q'; int order = letter - 'a'; ... char other_letter = 'a' + other_order; [/CODE] And as for your question about reading successive 2-digit numbers: [CODE] ... std::string next_num = std::string(string, pos, 2); pos += 2; int value = strtol(nex_num.c_str()); …

Member Avatar for predator78
0
263
Member Avatar for Web_Sailor

In Linux, something like: [B]prompt $[/B] gcc -g server.c -o server [B]prompt $[/B] server 12345 If you're using VS on Windows, you need to add the argument somewhere in the settings. Or after you build server.exe, open a Command Prompt window, [ICODE]cd[/ICODE] to where server.exe was placed, and then: [B]prompt …

Member Avatar for raptr_dflo
0
3K
Member Avatar for tux4life

[ICODE]temp[/ICODE] is defined as type [ICODE]char[/ICODE] at line 6. [ICODE]result[/ICODE] is an instance of class [ICODE]string[/ICODE]. There is no [ICODE]string.insert()[/ICODE] method variant that takes a [ICODE]char[/ICODE] argument, so the author used [CODE] string& insert ( size_t pos1, const char* s, size_t n); [/CODE] which takes an array of characters (or …

Member Avatar for ztdep
0
1K
Member Avatar for kchyn

Well it looks like you've done enough to get a buffer of ALint values. What is the range of possible valid values in that buffer? Then normalizing to float is as simple as: [CODE] float intermediate_value = (i_val - min_ival)/float(max_ival - min_ival); float f_val = min_fval + intermediate_value*(max_fval - min_fval); …

Member Avatar for raptr_dflo
0
410
Member Avatar for jimJohnson

Now that you've created a mapping of your input file and output file, what do you intend to do with each? You don't call isPalindrome() anywhere, nor does it look like you even iterate over your input mapping or set anything in your output mapping. Has anyone asked why you're …

Member Avatar for raptr_dflo
0
217
Member Avatar for Geek-Master

Hialek, at least one problem is in lines 27-30 of your code: [CODE] if(c=='\n'){ items.push_back ( vector<int>() ); i++; } [/CODE] The first time through, you don't have anything in items (assuming you don't have a blank line at the start of your file). The first time you [I]do[/I] get …

Member Avatar for Hialek
0
5K
Member Avatar for programing

Since you're presumably supposed to be writing your own stack implementation (using a singly-linked list) as part of your assignment, I'll start with your first few lines: [CODE] struct stack{ stack s1,s2; int info; }; [/CODE] First of all, you can't declare s1 and s2 to be of type [ICODE]stack[/ICODE] …

Member Avatar for raptr_dflo
0
230
Member Avatar for sim08u

Since your savings-account, checking-account, and credit-account classes are identical (or nearly so), consider starting with a base class: [CODE] class GenericAccount { /* mostly the same stuff you already have */ GenericAccount(int accountNum, float balance, float interestRate); }; [/CODE] and then inherit it, overriding any methods that need to change, …

Member Avatar for raptr_dflo
0
3K
Member Avatar for dan2011

It's been quite a while since I did C/C++ in MSVS, but try creating a new console-type program, and it will probably provide you a stub main() of some sort, along with all the libraries it thinks you'll need. Then rename your existing main() to something else (a "normal" function), …

Member Avatar for predator78
0
86
Member Avatar for TrustyTony

Hey tonyjv, If you use strok(), it successively replaces the next occurrence of the ';' (or whatever) with a '\0' (indicating end of string), and returns the location of the start of the preceding string. So, if you're stuck with fixed-size fields in your struct, you can use strncpy to …

Member Avatar for Narue
0
1K
Member Avatar for Simplicity.

Other issues: In Intialize, the second two elif: blocks will not execute, because you've already handled those ranges in the first two. Instead, move the assignments to indented blocks starting on the following line, and consolidate your u[0][k] and u[1][k] assignments. Also, since Initialize returns the u array, declare it …

Member Avatar for Simplicity.
0
448
Member Avatar for darkdai

Tony has a good point: whether or not you use command-line arguments for this program, you should get in the habit of defining your main() as: [CODE] int main (int argc, char *argv[]) { ... } [/CODE] It is also customary to return 0 from main on success, and non-zero …

Member Avatar for Narue
0
113
Member Avatar for HASHMI007
Member Avatar for HASHMI007
1
111
Member Avatar for jimJohnson

You need to add command-line arguments. Jason just told you how to do that, either through VisualStudio or by running the program from a command-prompt.

Member Avatar for jimJohnson
0
139
Member Avatar for EarendurRingern

I think your control in line 12 might be problematic. Try: [CODE] for (c=string; (c==string || *(c-1) != '\n') && c-string < 220;) *c++ = (char)getchar(); [/CODE] Or try: [CODE] if (fgets(string, 220, stdin)) { int last_char_index = strlen(string) - 1; if (string[last_char_index] == '\n') string[last_char_index] = '\0'; else string[0] …

Member Avatar for raptr_dflo
0
1K
Member Avatar for Ajay2100

Please, use CODE blocks around included code. Paste the code you want to include, then go back and select it, and click the conspicuously-named "[ CODE ]" button above the text-entry window. Otherwise, your problem is trying to build a project with out-of-date files, or possibly an out-of-date macro definition. …

Member Avatar for raptr_dflo
0
281
Member Avatar for henrimontreal

Your logic is flawed in draw_rect(), for how you decide whether to draw a filled rect or a hollow rect. If you can say it to yourself clearly, you can get it right without any additional help. Also, consider using your line_maker function for the empty space inside a non-filled …

Member Avatar for raptr_dflo
0
260
Member Avatar for ShadowScripter

Patience, young Luke. I'm not a D3D expert, but there probably are a couple around here somewhere. They might not get back to you on the weekend. While I know next-to-nothing about this, I'd like to think that the functions that load a compressed image would uncompress it as part …

Member Avatar for ShadowScripter
0
211
Member Avatar for andylbh

Hi andy, While helpful, sergent and mike missed the original problem: your main() failed to call p1.setDistFrOrigin() before printing it, so you were getting whatever garbage happened to be in that memory location. Also, if I recall correctly, since pow() is written to support non-integer exponent values, it's not necessarily …

Member Avatar for andylbh
0
705
Member Avatar for strungoutfan78

hey strungoutfan78, Despite all the intervening help, I think your original add() function was fine as written, and all you needed to do is, after calling "curNode->add( *( tv + i ), curNode );" (originally at line 40), to advance curNode: [CODE] curNode->add( *( tv + i ), curNode ); …

Member Avatar for strungoutfan78
0
530
Member Avatar for eng51

Any chance this helps? [url]http://delphi.about.com/od/delphitips2008/qt/format_richedit.htm[/url] The source is in Pascal, but with any luck, your C++ interface is similar....

Member Avatar for raptr_dflo
0
123

The End.