Posts
 
Reputation
Joined
Last Seen
Ranked #362
Strength to Increase Rep
+8
Strength to Decrease Rep
-2
90% Quality Score
Upvotes Received
16
Posts with Upvotes
16
Upvoting Members
10
Downvotes Received
2
Posts with Downvotes
2
Downvoting Members
1
16 Commented Posts
~190.83K People Reached
Favorite Tags

186 Posted Topics

Member Avatar for bis student

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 your enum bloodType tries to use invalid characters as variable/enumeration names. Try using allowable names. setting the default address …

Member Avatar for Alia_2
0
3K
Member Avatar for badmofo

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 units place). If the number is more than 9, the function will …

Member Avatar for Ali_40
0
876
Member Avatar for daviddoria

[QUOTE=daviddoria;587847]I would like to take a screenshot of a region of my screen programmatically (so I can do it every time through a loop, for example.) Does anyone know how to do this? I guess it would involve the win32api - I've not used this before so any hints would …

Member Avatar for dougy83
0
3K
Member Avatar for dougy83

Hi all, Does anyone know how to quickly (i.e. O(log n) time) insert items into a sorted list? I'd prefer an existing working function if available; I didn't see any appropriate ones in boost or stl. Some background: I'd like to keep a constant sized sorted list, and insert items …

Member Avatar for dougy83
0
13K
Member Avatar for dougy83

Hi all, I'm writing a simple application in C# but I'm having an annoying ArgumentOutOfRangeException thrown by Invoke() saying "Text length must be less than 64 characters long.". Is this usual that strings passed through delegates have to be shorter than 64 characters? What's the usual neat way around it? …

Member Avatar for dougy83
0
252
Member Avatar for dougy83

Hi all, I have an application with a ListView of remote files. I'm trying to implement a drag-drop of these files between my application and e.g. windows explorer. I have an object implementing IDataObject used for the DragDrop operation and the files are passed in a string[]. The problem is …

Member Avatar for dougy83
0
715
Member Avatar for bramprakash1989

[code] int number = rand() % N; // gives you a random number from 0..(N-1) number += L; // the number between L..(L+N-1) [/code] So if you know your upper and lower limits, you can work out what N & L should be.

Member Avatar for dramatic
0
1K
Member Avatar for Cosa

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. [code=CPP] struct Matrix{ float *data; int rows, cols; float *operator[](int row){ return &data[row*cols]; } }; Matrix A; // read maxRows/cols from file …

Member Avatar for kabultanha
0
4K
Member Avatar for Lensva

To check if an iterator has passed over all elements compare it to the end (for iterators) or rend (for reverse iterators). [code] string::reverse_iterator rit = st.rbegin(); string::iterator it = st.begin(); for(; rit != st.rend() && it != st.end(); rit++, it++){ // do comparisons here [/code]

Member Avatar for rohitvipin
0
2K
Member Avatar for marufsiddiqui

Here's some code to help you get started with the C++ syntax for writing a matrix class. I've put the matrix sum function in for you - you'll have to write the other matrix functions. This code compiles and runs in Dev-c++4.9.9.2. As Rashakil Fol said, you may want to …

Member Avatar for idriz12
0
2K
Member Avatar for BBustos

[quote]I must take that pointer or address (I can't remember which it is) and convert it to a string[/quote]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 …

Member Avatar for sdeez_alpha
0
5K
Member Avatar for noora000

I've used the old Ericsson mobiles to read contents of SIM cards and to send/read SMSs. The commands are sent to the mobile using your serial port at 9600,n,8,1 - you will need to convert the RS232 level (+/- 10 volts) to TTL level (0-5 volts) - can use MAX232 …

Member Avatar for usamakarim
-1
1K
Member Avatar for ojung

[QUOTE=ojung;755253] cout<<"Enter word to search \n"; cin>>word[i];[/quote] that should be [code]cin >> word;[/code], because word[i] is a char, and word is a char array [quote] while(dict.getline(text,300)) { if(word[j]!=text[j]) { [/QUOTE] Likewise this should be [code]... if(string(text).find(word) != string::npos){ ...[/code], otherwise you are comparing the first character only, and not the …

Member Avatar for onksssss
0
10K
Member Avatar for Suraine

I think by 'infinite array' you are meaning something like 'sparse array' - where only a few elements over a large range are non-zero. You can use a std::map<int, int> for your array of ints using an integer index. [code] map<int, int> array; array[20] = 5; array[51] = 6; cout …

Member Avatar for WaltP
0
10K
Member Avatar for Compton11

Here's the code in C#, shouldn't be hard to see what's going on: [url]http://www.codeproject.com/KB/recipes/ShortestPathCalculation.aspx[/url] There are plenty of other resources referenced from: http://en.wikipedia.org/wiki/Dijkstra's_algorithm

Member Avatar for sireeshakiran
0
720
Member Avatar for SurviBee
Member Avatar for doll parts

As ArkM stated, you don't need to return an integer value as a complex<double> (although you can if it pleases you, of course). I found the condition in the while() loop a little strange, so I changed it to: [QUOTE=doll parts;727072][CODE] while ((abs(f(x)) > error) && (n < nmax + …

Member Avatar for huss_584
1
2K
Member Avatar for dougy83

Hi, I have written a v. small VB.NET program that spawns "cmd.exe" using Process, redirects stdin/out/err; works OK so far. Does anyone know how to get : * the details about the process currently running (if any) under cmd.exe (like how the command shell displays 'c:\windows\system32\cmd.exe - dir /s/b' when …

Member Avatar for dougy83
0
331
Member Avatar for launic

How about you use code tags and post code that can be compiled. There are easier ways to get file listings by using the OS list functions & _popen(). The output can be read using fread(). In windows: "dir /s/b ", in Linux: you could try "ls -R -l ".

Member Avatar for zamp
0
576
Member Avatar for fireballnelson

[QUOTE=Comatose;766215]How can you dynamically allocate memory on the heap using a reference?[/QUOTE] [code]int &x = *new int();[/code] This should do it.

Member Avatar for ArkM
0
168
Member Avatar for shankhs

I have an dumb idea, what about an operation like convolving the test string with itself; i.e. doing a sliding comparision of the elements of the test string with the reversed-test-string. The longest consecutive string of matching elements is the longest palindrome. Here's the code: [code=cpp]// do some convolution string …

Member Avatar for cikara21
0
154
Member Avatar for mrnutty

or you could make a card class, e.g. [code=cpp]#include <iostream> #include <string> using namespace std; class Card{ private: int cardNumber; // 1 - 52 public: Card(int _cardNumber = 1) : cardNumber(_cardNumber) {} void setCardNumber(int _cardNumber){ cardNumber = _cardNumber; } void setCard(int cardType, int suitType){ // cardType e {1..13}, suitType e …

Member Avatar for dougy83
0
138
Member Avatar for MosaicFuneral

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 result. If it annoys you, feel free to cast to unsigned char, as …

Member Avatar for MosaicFuneral
0
294
Member Avatar for Superstar288

sprintf expects a char* as the first parameter; it is where it will store the output, as a string of characters. I don't know what you actually want to do, but if you want to see that it's working, try the following lines (instead of the sprintf lines above): [code=c] …

Member Avatar for dougy83
0
160
Member Avatar for cam875

[QUOTE=cam875;742372] object's new x,y position should display as (0.5,0.5) but everytime i run it with those values i get (0,1) and I am not sure what is wrong. [/quote] Not quite. Distance of 1 from (0,0) heading 45^ will be (0.707, 0.707) [QUOTE=cam875;742372][code=cpp] if (heading > 0 && heading < …

Member Avatar for cam875
0
99
Member Avatar for koushal.vv

then start at a value 1 more than the highest in the dB, if you wish to use incrementing type indexes. Or you could use the number of microseconds since (e.g.) 12:00am jan 1900 UTC as your 'unique number'.

Member Avatar for ArkM
0
146
Member Avatar for vladdy191

[QUOTE=Ancient Dragon;742495]>>a = c; That's illegal.[/QUOTE] Have you tried compiling it?

Member Avatar for dougy83
0
136
Member Avatar for dougy83

Hi. I have written a small test socket program that uses a background thread that accepts tcp connections and adds them to a connection list that is accessed by main(). When a connection is opened, then later closed, recv() is called (see line highlighted in code below), which throws an …

Member Avatar for dougy83
0
231
Member Avatar for Arctic wolf

For hi-res timers, you may want to have a look at the following (100us timer period): [url]http://www.codeproject.com/KB/system/RealTimeModule.aspx[/url] [QUOTE=Arctic wolf;736190]I need a real time clock to generate accurate PWM for a robot...[/QUOTE] What's the frequency of the PWM? Are you interfacing to RC servos?

Member Avatar for Arctic wolf
0
653
Member Avatar for LincolnGurl

[QUOTE=LincolnGurl;736380]From your rather elementary diagnosis of the VC++ debug code...[/quote] not so friendly hey? [QUOTE=LincolnGurl;736380]String1("Hello"); <- Familiar syntax, but length processed during run-time construction. OR String1(_MyMacro("Hello")); <- Reasonably familiar syntax, but length processed via compile-time construction and immediately available at run-time. [/quote] So what do you actually want? The length …

Member Avatar for LincolnGurl
0
305
Member Avatar for CPPRULZ

[QUOTE=CPPRULZ;731760]Our 16 by 16 array of bits now becomes a 2 by 16 array of bytes. [[I]Why isn't it a 2 by 2 array?[/I]] [/QUOTE] A byte is made up of 8 bits. Therefore a row can contain the 16 bits in 2 bytes. There are 16 rows, hence 2 …

Member Avatar for ddanbe
0
328
Member Avatar for Alex Edwards

[QUOTE=VernonDozier;731746]When in doubt, write a program! It's faster and more accurate than research.[/quote] ummm.... google seems to quickly turn up a bunch of results for this question, e.g. [url]http://www.cppreference.com/wiki/operator_precedence[/url] You're right, division/multiplication/modulus all have equal precedence. [QUOTE=VernonDozier;731746] ... It's one of the reasons I never liked "PEMDAS". If all you …

Member Avatar for Alex Edwards
0
7K
Member Avatar for Jacky1

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 will know how to access the .dll file from the details stored in the .lib file.

Member Avatar for Jacky1
0
118
Member Avatar for skatamatic

I wrote an equation parser a few years back, don't have it on me, but I'll try to dig it up for you. I think the idea I used was to pass through the equation string a few times - the first time assigns a numerical priority to each operator …

Member Avatar for iamthwee
0
134
Member Avatar for jbrock31

Dunno from the code you posted. Was the data even written properly in the first place? Did you open the fstream in binary mode?

Member Avatar for skatamatic
0
131
Member Avatar for Kanvas

yes. You'll be using [icode]travel ** travelArray[/icode] That said, your assignment line will of course be [icode]travelArray[index] = &aTrip;[/icode] I noticed you check if index <= size. If the array declared has size elements, this will be a problem; if the array declared has size+1 elements, then it is not …

Member Avatar for dougy83
0
139
Member Avatar for mrrko

[QUOTE=mrrko;710457][CODE]double fib(int iter) { while (iter >= 0) { while (iter >= 0) { fib(0) = sizeCrudPopulation; } while (iter >= 1) { fib(1) = sizeCrudPopulation; } while (iter >= 2) fib(iter) = (fib(iter - 1) + fib(iter - 2)); } } [/CODE][/QUOTE] Most of your code (not the above …

Member Avatar for mrrko
0
407
Member Avatar for NinjaLink

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; before you get to report the location the seqOrderedSearch function should return …

Member Avatar for Ancient Dragon
0
194
Member Avatar for egolovin

This thread seems to be predecessor to [url]http://www.daniweb.com/forums/thread150474.html[/url]

Member Avatar for grumpier
0
172
Member Avatar for egolovin

What [QUOTE=egolovin;709894]can someone look at this? in theory it should work but i cant figure it out thanks in advance [CODE=CPP] if (test==1)[/CODE][/QUOTE] That line should be [icode] if (test == '1')[/icode] 1 is different to '1' (character code 49, as Rhohitman said). Also, for powers of 2 you don't …

Member Avatar for egolovin
0
333
Member Avatar for dexter1984

setw works fine without the need for '\t'. Note that setw is required prior to each item to be formatted. e.g. [icode] cout << left << setw(12) << "item1" << setw(12) << "item2" << endl;[/icode]

Member Avatar for dexter1984
0
154
Member Avatar for rhoit

I don't think it's in the language. You could use #define square box. You may want to google template typedefs, or check out [url]http://www.gotw.ca/gotw/079.htm[/url] for some solutions.

Member Avatar for rhoit
0
2K
Member Avatar for alleycot

[QUOTE=Freaky_Chris;704970]So you have 2 choice's pay someone...again good luck cause most ppl still won't do this OR DO IT YOURSELF(at least have a good go)[/QUOTE] What?? I know a lot of people who will write code for money (myself included). I believe it's fairly standard practice; even a respectable career …

Member Avatar for Ancient Dragon
1
266
Member Avatar for Gary_nel

Windows CE has APIs for this kind of thing. The prototype for the function is [code]BOOL CopyFile(LPCTSTR lpExistingFileName, LPCTSTR lpNewFileName, BOOL bFailIfExists); [/code]. Go to MSDN if you need info on return values, etc. try [url]http://msdn.microsoft.com/en-us/library/ms959899.aspx[/url]

Member Avatar for dougy83
0
134
Member Avatar for Linking_90

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 a dirty brute-force method: [code=CPP]#include <iostream> #include <iomanip> #include <sstream> using namespace std; bool numberValid(int v, int len){ …

Member Avatar for Linking_90
0
112
Member Avatar for justinlake888

Do you not know how to use google (or any other search engine)? You will find more than you need if you actually try looking for it. Try [url]http://en.wikipedia.org/wiki/Global_variable[/url]

Member Avatar for dmanw100
0
126
Member Avatar for happy8899

I'm pretty sure there's oodles of freely available guides available to tell you how to use openCV. Try [url]http://www.google.com/search?hl=en&rls=com.microsoft%3Aen-au&q=opencv+visual-studio[/url] Failing that, I found the following works for me: Basically what you have to do is set up your project to include the following files: "c:/Program Files/OpenCV/lib/cv.lib" "c:/Program Files/OpenCV/lib/cvaux.lib" "c:/Program Files/OpenCV/lib/cvcam.lib" …

Member Avatar for dougy83
0
368
Member Avatar for opposition

I can't see any reason why you don't just split all the fields, assign: [code=pseudocode] field[] = split(line, " ") genre = field[0] category = field[1] title = field[2] n = field.count()-1 for i = 3 to n-1 title = title + " " + field[i] next i time = …

Member Avatar for Narue
0
152
Member Avatar for meddlepal

The count method is incorrect; there is no terminating condition, hence the stack overflow. [icode](map[valueRow][valueCol + 1] != 'b' || map[valueRow][valueCol + 1] != 'v')[/icode] will always be true, as the map element cannot be equal to both 'b' and 'v'. You should also check the map indices you are …

Member Avatar for ArkM
0
234
Member Avatar for iNeedHelpPlease

use getline to read the inputSentence from cin. This will stop reading when it gets the enter key. put the entered sentence into a stringstream. read the words out of the stringstream while there are words to read. [code=cpp] #include<iostream> #include<string> #include <sstream> using namespace std; const string chicken( "chicken" …

Member Avatar for dougy83
0
267

The End.