279 Posted Topics

Member Avatar for u8sand

You're trying to pass a const object to a function that does not receive a const object. Change one or the other.

Member Avatar for u8sand
0
156
Member Avatar for cbreeze

You need to initialize filledCount to zero (or get rid of it and just use i). Try putting the [icode]cin.ignore()[/icode] before [icode]cin >> choice[/icode]

Member Avatar for cbreeze
0
112
Member Avatar for bbloopa

You're looking for something like this: [code] struct Class { string name; int num; Day meet; // For Day use whatever is appropriate Time start; // Ditto for Time Time end; string teacher; int n umStudents; }; cin >> planner[x].name; cin >> planner[x].num; [/code] As for making the array index …

Member Avatar for bbloopa
0
88
Member Avatar for sarahnade17

Is it because you're calling [icode]start()[/icode] at the beginning of [icode]getNext()[/icode]? According to your comment for start() it moves the pointer to the beginning of the list.

Member Avatar for sarahnade17
0
114
Member Avatar for daviddoria

Filter the output with grep: [icode]./Test "$i.txt" "$i.obj" | grep -vi '^[:alpha:]'[/icode] Perl's good for this: [code] for $i (1..5) { for (`./Test $i.txt $i.obj`) { next if /^\s*\w/; print; } } [/code]

Member Avatar for nucleon
0
162
Member Avatar for stickboy

If the grid is not too large, I would use a 2D array of car pointers as well as the linked list. Init the array to zeroes. When you choose a random position for a car, check that the position in the array is 0, then either store the car …

Member Avatar for IVR_Developer
0
95
Member Avatar for Dewey1040

It doesn't always return zero. (Try 4, 5, 6.) But you should probably make at least s a double, and probably also a, b, and c.

Member Avatar for uskok
0
118
Member Avatar for jspeakers

What is the format of the wave files? Is it PCM or are they compressed?

Member Avatar for nucleon
0
400
Member Avatar for shea279

Have you looked at [url=http://msdn.microsoft.com/en-us/library/ms646309(VS.85).aspx]RegisterHotKey[/url] ?

Member Avatar for shea279
0
104
Member Avatar for Zcool31

That is a contradiction. windows.h provides the functionality of the windows platform. You're probably thinking of some piece of that functionality, such as might be provided by OpenGL etc.

Member Avatar for Ancient Dragon
0
66
Member Avatar for Valaraukar

I only looked at allocate_memoryi and reallocate_memoryi. Any problems with them probably also exist in the "f" models. Compare the code below with the original carefully to see the differences. [code=c++] GLint ***allocate_memoryi(int nShapes, int nRows, int nCols) { GLint ***shapeArray; shapeArray = (GLint***) malloc(nShapes * sizeof(GLint**)); for(i=0; i<nShapes; ++i) …

Member Avatar for nucleon
0
195
Member Avatar for sgw

time's parameter is an alternate return path. If you pass in NULL (or 0) it is ignored. Otherwise, you must pass the address of a time_t object which will be filled with the time.

Member Avatar for ArkM
0
23K
Member Avatar for littlespy

You're gonna kick yourself! Instead of this [icode]for(i = 1; text_tokenized[i] != NULL; i++)[/icode] You mean this: [icode]for(i = 1; i < words; i++) {[/icode]

Member Avatar for nucleon
0
100
Member Avatar for WaelTheNoble

Assuming Windows, here's an example of waiting for an exe to finish. [code] STARTUPINFO si = {sizeof (STARTUPINFO)}; PROCESS_INFORMATION pi; CreateProcess( "\\windows\\notepad.exe", NULL, 0, 0, 0, 0, 0, 0, &si, &pi ); WaitForSingleObject( pi.hProcess, INFINITE ); [/code]

Member Avatar for WaelTheNoble
0
3K
Member Avatar for DemonGal711

I was thinking she needed something more complicated too, but now that I look again, maybe she [i]is[/i] looking for an n-ary tree. Taking her example, starting with a given root word (e.g. "cat"), generate all words with one letter different: [code] * for each letter in word * go …

Member Avatar for DevC++4.9.9.2
0
785
Member Avatar for computercobra

The design depends on how it will be used. Write a driver (a main) that uses the object's interface AS IF it was already written. Then create a class for an object that fits that interface. It also depends on how much detail you want in the simulation. If you …

Member Avatar for computercobra
0
2K
Member Avatar for seaders

It would seem that your only hope (besides the static idea) is to investigage what MOUSEHOOKSTRUCT's dwExtraInfo member holds.

Member Avatar for nucleon
0
712
Member Avatar for Zcool31

I could be wrong ;), but I don't think it's possible. I believe you have to explicitly give the return type, like so: [code] template <typename U, typename T> U foo(T& param) { return *param; } // ... int n = foo<int>(i); [/code]

Member Avatar for nucleon
0
98
Member Avatar for Peyton
Member Avatar for greg022549
0
1K
Member Avatar for daviddoria

I'm not sure I understand your question. Why can't you just [icode]#include "Point.h"[/icode]? I do not see anything circular here.

Member Avatar for tux4life
0
296
Member Avatar for Dewey1040

You need to set y to 1 at the top of the loop so it's initialized every iteration. Your do{}while() condition should be x > 0 since you want to multiply every digit together here. The outer while() condition should still be x > 9.

Member Avatar for Dewey1040
0
2K
Member Avatar for kuru225

AD: If the (originally) larger number is even you simply don't add the (originally) smaller one to the accumulator. Since "odd" just means that the one's bit is set, it's essentially binary mutiplication using shifts (division by 2) and adds. kuru: Have you written a program before? Do you have …

Member Avatar for kuru225
0
169
Member Avatar for CoolAtt

You could try [b]signal()[/b]: [code] #include <stdio.h> #include <signal.h> void cleanup(int unused) { printf("Cleaning up\n"); exit(-1); } int main() { signal(SIGINT, cleanup); for (;;) /* Ctrl-C to exit */ ; } [/code]

Member Avatar for CoolAtt
0
255
Member Avatar for Lukezzz
Member Avatar for Azurkan

If you simply want the numbers 1 to 9 uniquely randomized in a row, you could load the row with the numbers 1 to 9 and then shuffle it. No need to pick random numbers and check if they've already been picked. That's always something to avoid, if possible. However, …

Member Avatar for nucleon
0
100
Member Avatar for jimjohnson123

Your program makes very little sense. Either you are using an object or you are not. You should clarify that with your instructor. This does not look like a case where you would use an object (although I'm learning that school exercises can be weird).

Member Avatar for nucleon
0
151
Member Avatar for Hiroshe

Your tobase10 function does not work properly, and it is overly complicated. You do not need log10 or pow. You can loop until result becomes 0 (instead of using log10). A special case here is when result starts out as zero. Instead of pow you can start a number at …

Member Avatar for Hiroshe
0
216
Member Avatar for raymyster

People generally like a more specific question. What exactly is the problem?

Member Avatar for VernonDozier
0
325
Member Avatar for CPPRULZ

Your example is not quite correct. You mean to do this: [code] base* pb = &d; cout << pb->get_tag() << endl; [/code] Simply declaring a base object and calling a method on it will never invoke a method of a derived object since the base object knows nothing about the …

Member Avatar for nucleon
0
110
Member Avatar for cruisx

To be complete, there is one other possibility. You can specifically call the non-unicode function by appending A to the function name. The other methods are probably better, though. [icode]ShellExecuteA(...);[/icode]

Member Avatar for nucleon
0
15K
Member Avatar for Dewey1040

Your gcd is not quite right. The recursive call should be [icode]gcd(x, i % x)[/icode].

Member Avatar for nucleon
0
87
Member Avatar for toucan

> the 15 on line 12 doesn't count either. There are two 15's on line 12. You should probably post this in the Perl section. I'd try (in Perl): [icode]/\..*\s(15|53|92)\s.*=>/[/icode]

Member Avatar for toucan
0
138
Member Avatar for JameB

It's ridiculous. And why do you include list (and the deprecated list at that)? You need to include iostream. And your main signature is wrong. Presumably you're supposed to be reading the input on stdin.

Member Avatar for nucleon
0
151
Member Avatar for Moe

And you should use iostream, not iostream.h. [code] #include <iostream> using namespace std; [/code]

Member Avatar for Moe
0
115
Member Avatar for sara khan

You need to use [url=http://www.daniweb.com/forums/misc-explaincode.html]code tags[/url], give more details about your problem, and ask a more specific question.

Member Avatar for nucleon
0
87
Member Avatar for dubbelodub

I'm not sure what the keyword "class" is doing in your map declaration, but using "int" would work like this: [code] #include <iostream> #include <string> #include <map> using namespace std; typedef map<int, int> t_map_inner; typedef t_map_inner::iterator it_inner; typedef map<string, t_map_inner > t_map_outer; typedef t_map_outer::iterator it_outer; int main() { t_map_outer m; …

Member Avatar for nucleon
0
76
Member Avatar for death_oclock

How tedious it is depends on how many different types you need to reverse. If just ints: [code] typedef unsigned char uchar; union IntBytes { int i; uchar b[sizeof(int)]; }; WriteInt( int n, FILE* fout ) { union IntBytes uBytes; int i; uBytes.i = n; for (i = sizeof(int) - …

Member Avatar for mcldev
0
853
Member Avatar for emiller7

Your declarations should be more like this. Change the definitions to match. [code] char getStuNames(char [][21], int); double getStuGrades(char [][21], double [][4], int, int); void displayGrade(char [][21], double [][4], int, int); [/code]

Member Avatar for VernonDozier
0
6K
Member Avatar for Alibeg

sizeof p gives the size of an int**. sizeof *p gives the size of an int*. sizeof **p gives the size of an int. sizeof *p[n] also gives the size of an int.

Member Avatar for nucleon
0
102
Member Avatar for bahr_alhalak
Member Avatar for johnray31

You can only put types in the angle brackets. You're trying to use a variable. Try this: [icode]map <int, list<CommandOp> > m_DynamicListMap;[/icode]

Member Avatar for nucleon
0
95
Member Avatar for daviddoria

You should use a const_iterator: [icode]vector<double>::const_iterator pos;[/icode] I'm assuming you have a [icode]using namespace std;[/icode] in your actual code. (Please post runnable code.)

Member Avatar for nucleon
0
193
Member Avatar for daviddoria

You need to instantiate the OutputObject template: [icode]for_each (V.begin(), V.end(), OutputObject<T>);[/icode]

Member Avatar for daviddoria
0
576
Member Avatar for shahab.burki

That's a lot of code with very little explanation of the problem. Also, too many tabs and blank lines, IMHO.

Member Avatar for computercobra
0
301
Member Avatar for emiller7

Your basic problem is that you are assuming row is a char when it is actually an int. Additionally, you are using the parameters row and col of the player functions like local variables. Remove them from the function declaration and declare them as locals, making row a char. Don't …

Member Avatar for emiller7
0
83
Member Avatar for bobrien314

USE CODE TAGS!!! Having said that, is it possible you mean to use brk and not sbrk?

Member Avatar for nucleon
0
107
Member Avatar for JAGgededgeOB172

(Assuming you're not allowed to use std::list...) It can be tricky swapping elements in a singly-liked list. Make diagrams so you can see what's needed. You'll probably need extra pointers to remember the previous elements of the two pointers with which you're traversing the list. Also, after you swap two …

Member Avatar for JAGgededgeOB172
0
104
Member Avatar for Acis

People don't generally like "help me" or other generalized titles. A better title for your post would be "Problem in text-based RPG". That sounds much more intriguing! I haven't seen this kind of thing before: [icode]if (Energy >= 5, Energy -= 5)[/icode] Do you realize that the [icode]Energy -= 5[/icode] …

Member Avatar for nucleon
0
74
Member Avatar for emiller7

You need to declare showBoard like this: [icode]void showBoard(char[][3], int, int);[/icode] Note that this hardcodes the size of the second dimension, but that will be okay if the board is always 3 by 3 (or indeed anything by 3).

Member Avatar for emiller7
0
3K
Member Avatar for PCli

In C, the assignment operator returns an rvalue. In C++ it returns an lvalue, so your first example should work. (Look up lvalue, rvalue if you don't know what they are.)

Member Avatar for PCli
0
110

The End.