Search Results

Showing results 1 to 40 of 65
Search took 0.01 seconds.
Search: Posts Made By: dougy83 ; Forum: C++ and child forums
Forum: C++ Dec 12th, 2008
Replies: 5
Views: 983
Posted By dougy83
Forum: C++ Nov 29th, 2008
Replies: 3
Views: 445
Posted By dougy83
assuming str is of type 'string', str[i] is of type 'char'. chars will be considered negative whenever the top bit is set. It's not an issue if you are bitwise ORing, as you will get the correct...
Forum: C++ Nov 22nd, 2008
Replies: 5
Views: 446
Posted By dougy83
Not quite. Distance of 1 from (0,0) heading 45^ will be (0.707, 0.707)


Where did you get this formulae? Travelled distance is not proportional to heading. try dx = distance * cos(heading / 180....
Forum: C++ Nov 9th, 2008
Replies: 6
Views: 868
Posted By dougy83
ummm....

google seems to quickly turn up a bunch of results for this question, e.g. http://www.cppreference.com/wiki/operator_precedence
You're right, division/multiplication/modulus all have...
Forum: C++ Nov 8th, 2008
Replies: 2
Views: 1,400
Posted By dougy83
include the dll.h header, and not the project3.dll file.

Make an import library - the .lib file, should be an option in your compiler/linker

link the .lib file into your project. The program...
Forum: C++ Nov 4th, 2008
Replies: 6
Views: 3,234
Posted By dougy83
If you're just displaying the reversed thing to the screen, there is no need to store any numbers in any arrays.

Each call to the function will print out a single digit (the digit of number in the...
Forum: C++ Oct 11th, 2008
Replies: 8
Views: 634
Posted By dougy83
Line 20 should be moved to after line 24: you want to let the user enter the search value before you call the search function.

line 86: remove this line - the break statement would quit the loop;...
Forum: C++ Oct 11th, 2008
Replies: 2
Views: 361
Posted By dougy83
setw works fine without the need for '\t'. Note that setw is required prior to each item to be formatted.

e.g. cout << left << setw(12) << "item1" << setw(12) << "item2" << endl;
Forum: C++ Oct 3rd, 2008
Replies: 6
Views: 1,512
Posted By dougy83
You would only scan to the left if a more-right digit couldn't be incremented - in which case you would try to increment a digit to the left. When you find a digit that can be incremented, you would...
Forum: C++ Oct 3rd, 2008
Replies: 6
Views: 1,512
Posted By dougy83
Obviously recursion would enable a simpler/cleaner approach, if it were allowed.

There is no mention of need for speed/efficiency in the problem statement, so it may be perfectly valid to just use...
Forum: C++ Sep 25th, 2008
Replies: 10
Views: 866
Posted By dougy83
just copy all the string data into a temporary buffer and pass it to the function. e.g.
main(){
vector<string> st;

st.push_back("test11g 1");
st.push_back("tes22ng 2");
...
Forum: C++ Sep 16th, 2008
Replies: 14
Views: 1,798
Posted By dougy83
Those macros are defined elsewhere in the makefile, and that line shows very little information about your specific problem. Post the whole makefile.
Forum: C++ Sep 16th, 2008
Replies: 1
Views: 613
Posted By dougy83
If you want the ints to be read only, make them const also (requires the following casting):

const vector<const int*> & getV() { return *(const vector<const int*>*)&myV; };
Forum: C++ Sep 16th, 2008
Replies: 4
Views: 441
Posted By dougy83
change the precision of the stringstream
stringstream c1;
c1.precision(100);
c1 << Total;
Replacing = c1.str();
Forum: C++ Sep 16th, 2008
Replies: 14
Views: 1,798
Posted By dougy83
Are you sure you googled it? There's about a billion relevant hits on 'setsupendstate'.

from the horses mouth:
http://msdn.microsoft.com/en-us/library/aa373201.aspx

BOOLEAN is true/false...
Forum: C++ Sep 6th, 2008
Replies: 6
Views: 605
Posted By dougy83
What language are you using to call the dll?? You said VB above (I assumed vb6), are you sure it's not VB.net or Visual Basic 2005/6/7/8?? vb6 successors have different data types to vb6 - I think...
Forum: C++ Sep 6th, 2008
Replies: 6
Views: 605
Posted By dougy83
You do need both the *.def file and use of _dllspec(__export) if you want clean names exported from the dll (at least in MinGW and VC++2008). Without the def file, you will export a function...
Forum: C++ Sep 6th, 2008
Replies: 6
Views: 605
Posted By dougy83
The VB declare statement should be:
declare function sum lib "example1.dll" (byval x as long, byval y as long) as long where example1.dll is the name of your dll file.
Forum: C++ Sep 6th, 2008
Replies: 9
Views: 2,057
Posted By dougy83
Please use code tags in future to make code more readable.

The error is due to top() returning a temporary reference, and you're trying to reference it as non-constant. You could use a const...
Forum: C++ Jul 5th, 2008
Replies: 18
Views: 2,712
Posted By dougy83
I'll be more specific:
// check:
for( int j = 0; j < Y; ++i )

or even what you've changed it to

for( int j = 0; j < Y; i++ )

for that matter.
Forum: C++ Jul 5th, 2008
Replies: 18
Views: 2,712
Posted By dougy83
You've got this sequence twice in your code - it's wrong both times. Also, you should check whether the map location exists before you access it - e.g. map[-1][-1] is not actually in the map[][]...
Forum: C++ Jun 27th, 2008
Replies: 6
Views: 2,591
Posted By dougy83
I have it at the following locations:

C:\Dev-Cpp\bin\dlltool.exe
C:\Dev-Cpp\mingw32\bin\dlltool.exe

But that's because I use dev-c++ (mingw) not VC++. You should be able to download it from...
Forum: C++ Jun 25th, 2008
Replies: 6
Views: 2,591
Posted By dougy83
Doesn't impdef extract the .def file for you?
so:
"e:\>bcf\bin\impdef lt360lib.dll > lt360lib.def"

will give you the .def file, then to make the import library (.a or .lib) use dlltool with the...
Forum: C++ Jun 15th, 2008
Replies: 4
Views: 1,418
Posted By dougy83
Correct, 1 for negative. See http://en.wikipedia.org/wiki/Twos_complement for how it's done
Forum: C++ May 9th, 2008
Replies: 3
Views: 430
Posted By dougy83
Both the member function declaration and definition will require the const modifier. This tells the compiler that the function is an 'inspector' function and will not modify anything in the object...
Forum: C++ Apr 26th, 2008
Replies: 9
Views: 1,028
Posted By dougy83
I've never heard of that kind of triangle. Are you sure it's a valid form?
Forum: C++ Apr 26th, 2008
Replies: 27
Views: 3,925
Posted By dougy83
Make sure you store the number of rows & cols of each matrix. This may be easier if you put them in a matrix class or struct.

e.g.

struct Matrix{
float *data;
int rows, cols;

...
Forum: C++ Apr 14th, 2008
Replies: 1
Solved: Swapping Arrays
Views: 1,422
Posted By dougy83
Just swap the pointers, as long as nothing else is referencing any elements in the arrays. If there are other references/pointers pointing into the array then do something else - like the temporary...
Forum: C++ Apr 14th, 2008
Replies: 10
Views: 2,278
Posted By dougy83
You can use stringstreams, itoa or sprintf to convert your int to a string of chars.



The error would have been that you can't convert an int to a char _pointer_, not char. C++ doesn't...
Forum: C++ Apr 13th, 2008
Replies: 2
Views: 459
Posted By dougy83
put the srand(time(NULL)); in the main(), such that it is run only once.

As you have it, every time RandomNumber() is called, srand() is seeded with the same value - hence rand() returns the same...
Forum: C++ Apr 13th, 2008
Replies: 3
Views: 2,704
Posted By dougy83
I think you're mixed up a bit (or maybe I am). I'm assuming GetScore returns true if the user enters a valid number. You've got this correct.

I'm also assuming that GetScore is supposed to set...
Forum: C++ Apr 12th, 2008
Replies: 9
Views: 675
Posted By dougy83
Ancient Dragon just just told you. Set valid = true before the loop. In the loop, if you find a bad character, set valid = false. Never set valid = true inside the loop. This way, when the loop is...
Forum: C++ Apr 11th, 2008
Replies: 2
Views: 675
Posted By dougy83
You have many many errors in your code. Are there any errors in particular that you're having trouble understanding?


you don't need the line: BloodDonor bldDnr; or any reference to bldDnr
...
Forum: C++ Apr 11th, 2008
Replies: 22
Views: 4,330
Posted By dougy83
Polynomial addition is NOT exclusive-or; it's addition!

How is this right??

See:
http://www.purplemath.com/modules/polymult.htm

You'll probably want to use what they call 'vertical'...
Forum: C++ Apr 11th, 2008
Replies: 22
Views: 4,330
Posted By dougy83
Regarding the order for multiplication, an example:
m1 = 1.x^2 + 1.x^1 + 2, order 2
m2 = 1.x^3 + 1.x^2 + 1.x^1 + 2, order 3
r = 1.x^5 + 2.x^4 + 4.x^3 + 5.x^2 + 4.x + 4, order 5

notice...
Forum: C++ Apr 11th, 2008
Replies: 1
Views: 360
Posted By dougy83
Yes.

for(<init>; <condition>; <iterator>){
//...
}

<init>
while(<condition>){
//...
<iterator>
Forum: C++ Apr 11th, 2008
Replies: 6
Views: 2,700
Posted By dougy83
To check if an iterator has passed over all elements compare it to the end (for iterators) or rend (for reverse iterators).

string::reverse_iterator rit = st.rbegin();
string::iterator it...
Forum: C++ Apr 11th, 2008
Replies: 22
Views: 4,330
Posted By dougy83
Isn't the polynomial structure kinda similar to a vector??

What's wrong with defining Poly as derived from std::vector<double>?? It makes all the new/delete stuff go away, and looks neater and...
Forum: C++ Apr 10th, 2008
Replies: 9
Views: 1,841
Posted By dougy83
Why don't you try running the program and pressing the enter key. The program will display the code for the key. Then you can put the key code as a case in the switch() just like what has been done...
Forum: C++ Apr 7th, 2008
Replies: 9
Views: 1,841
Posted By dougy83
You'll probably want to run it in a loop - the code I gave only checks once for a keypress. so:

while(1){
[ insert the keychecking code I posted here...]
Sleep(1); // don't use 100% cpu...
Showing results 1 to 40 of 65

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC