Posts
 
Reputation
Joined
Last Seen
Ranked #359
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
~186.46K People Reached
Favorite Tags
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
874
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
247
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
712
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
707
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
235
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
561
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
165
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
150
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
135
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
263
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
152
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
89
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
133
Member Avatar for vladdy191

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

Member Avatar for dougy83
0
132
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
228
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
631
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
296