Posts
 
Reputation
Joined
Last Seen
Ranked #44
Strength to Increase Rep
+16
Strength to Decrease Rep
-4
96% Quality Score
Upvotes Received
174
Posts with Upvotes
160
Upvoting Members
69
Downvotes Received
5
Posts with Downvotes
5
Downvoting Members
5
138 Commented Posts
7 Endorsements
Ranked #260
Ranked #65
~692.79K People Reached
Favorite Tags

1,296 Posted Topics

Member Avatar for rodeostar04

If you include <cmath> sqrt function lives in std namespace. So declare [icode]using namespace std;[/icode] or (better) use std::sqrt(...) or declare [icode]using std::sqrt;[/icode]. Probably, that's all your troubles now...

Member Avatar for N@sir
0
5K
Member Avatar for Nikhar

The Language Primary Source: [quote]simple-escape-sequence: one of ' \" \? \\ \a \b \f \n \r \t \v ... Alphabetic escape sequences representing nongraphic characters in the execution character set are intended to produce actions on display devices as follows: \a (alert) Produces an audible or visible alert without changing …

Member Avatar for rubberman
0
2K
Member Avatar for Esmerelda

From [url]http://homepages.cwi.nl/~dik/english/mathematics/armstrong.html:[/url] [quote]An Armstrong number is an n-digit base b number such that the sum of its (base b) digits raised to the power n is the number itself.[/quote] a = a^1 { 1, 2, 3, 4, 5, 6, 7, 8, 9 } ab = a^2 + b^1 {} abc …

Member Avatar for Tushar_4
0
2K
Member Avatar for payara111

Well, start from this forum announcement: [url]http://www.daniweb.com/forums/announcement8-2.html[/url]

Member Avatar for Chetana_1
-1
2K
Member Avatar for Duki

The VC++ now defines CLOCKS_PER_SEC (old CLK_TCK) macros as 1000, so there are no bad scaling in that case. However a real measured interval (i.e. VC++ RTL clock() precision) is about 15 milliseconds, so it's impossible to measure short intervals (iterative variant with clock() ticks <2 MICROseconds!). For example, look …

Member Avatar for Loïc
0
940
Member Avatar for homeryansta

Generally speaking, it's an absolutely senseless operation to compile header file with a single class definition. No correspondend code (object module) generated. May be the compiler go off its head while performing such an action ;),,,

Member Avatar for Syed Zuman
0
969
Member Avatar for justinlake888

Probably, all beginners write verbose and heavy-to-read codes. Don't complicate your as it is not so easy life with monstrous switches. Use this common approach: [code=cplusplus] const char* numeral[] = { "", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve" }; ... cout << numeral[num] << …

Member Avatar for hermel
0
2K
Member Avatar for GuitarComet

A user-defined main() is not the first (and the only) function in the executable module. Have you ever heard about sturtup code? A console mode program has opened i/o streams - it's a job for startup code. It has a properly initialized memory heap - it's a job for startup …

Member Avatar for Ömer
0
323
Member Avatar for cassie_sanford

Sorry, but it's impossible to read your snippet. Please, use code tag properly: [noparse][code=c++] sources (with line breaks) [/code][/noparse]

Member Avatar for rafiq_1
0
830
Member Avatar for cam875

Of course, you can do that. It's called recursion. The only problem is to break recursive call chain in the proper moment. In other words you must prevent f() call which calling f() which calling f() again and so on...

Member Avatar for akshaykeerthi.srikanth
0
286
Member Avatar for MadnessCow

Use double (not float) type for math calculations! [code=c] double x, y, z, sum, pi; ... sum = 1.0; for (i = 0, y = 3.0; i < n; ++i, y += 2.0) { z = 1.0 / y; if ((i & 1) == 0) sum -= z; else sum …

Member Avatar for Adak
0
6K
Member Avatar for kishore84
Member Avatar for bramprakash1989

Apropos, I far as I know, [icode]rand() % N[/icode] (where rand() is a pseudo-random numbers generator) is NOT uniformely distributed in 0..N-1 range... Right (but cumbersom) construct is (alas): [code=cpp] (int)(N*(rand()/(double)MAX_RAND)) [/code]

Member Avatar for dramatic
0
1K
Member Avatar for rrreeefff

1. If you are using stdafx.h (in MS VC++), place all system includes in stdafx.h, not in your source modules. 2. Why [icode]#include "stdio.h"[/icode]? Must be [icode]#include <stdio.h>[/icode] directive in stdafx.h.

Member Avatar for deceptikon
0
346
Member Avatar for QuantNeeds

You have a class Tools with these (and others) member functions. Remember a syntax of member function call: [code=cplusplus] object.member_function_name(parameters) // or pointer_to_object -> member_function_name(parameters) [/code] So, for your test (member!) function call you must write, for example: [code=cplusplus] #include "Tools.h" ... int main() { Tools tools; ... tools.test(); ... …

Member Avatar for fiqa92
0
4K
Member Avatar for gtsreddy

Never use old Borland C++ compilers (except for dog fights with deviations of C++ standard). The [b]best[/b] free C++ compiler + IDE now is VC++ 2008 Express edition, of course. Regrettably, its distribution size is ~200 Mb + ~200 Mb for MSDN Expess (if you want more than rudimentary help) …

Member Avatar for vijayan121
0
718
Member Avatar for asadullah

I think, it's an absolutely aimless article (and discussion too), because of VTBL is not a part of C++ language. If you want to know how virtual functions calls were implemented in the specific C++ implementation. search Google (or what else;)), for example: [url]http://forums.msdn.microsoft.com/ru-RU/vclanguage/thread/0e2d1b36-1805-46de-afe8-ce7b6348fe28[/url] [url]http://bytes.com/forum/thread535605.html[/url] I have no time to …

Member Avatar for kresimir
0
3K
Member Avatar for plike922

Also pay attention: getchar(), getc(), fgetc() functions return int (not char) values. In essence, char type in C (but not in C++) is a very short int, that's all.

Member Avatar for I_m_rude
0
529
Member Avatar for nishant3316

1. Hamming distance for binaries: [url]http://en.wikipedia.org/wiki/Hamming_distance[/url] 2. Use CODE tag for snippets: [noparse] [code=c] your sources [/code][/noparse]

Member Avatar for SHIVANGII
0
627
Member Avatar for nizbit

Some remarks. Regrettably, niek_e's solution is a solution of another problem. It can replace one word only, not an arbitrary substring. Ancient Dragon's solution uses RTL library (not in spirit of original post, see length() function instead of strlen). [code=c] /// For this example only: inline int length(const char* s) …

Member Avatar for WytCZ
0
1K
Member Avatar for onemanclapping

I think we have an impressive example of a false problem. If you want to clear console window in portable manner, use portable direct console i/o library (pdcurses, for example, or others). That's the only right answer. May be a suitable ersatz of such libraries is <conio.h> stuff implemented with …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for fsemilla

I think it's an example of incorrect help request. I'm sure that you can't implement ZigBee protocol stack in C from the scratch. Look at TI Z-Stack free product (ZigBee compliant protocol stack): [url]http://focus.ti.com/docs/toolsw/folders/print/z-stack.html[/url] - download ~13 Mb zip. So it's not a problem - it's impossible for lonely heroes …

Member Avatar for agieli
1
2K
Member Avatar for twek

[code=cplusplus] bool cvtLPW2stdstring(std::string& s, const LPWSTR pw, UINT codepage = CP_ACP) { bool res = false; char* p = 0; int bsz; bsz = WideCharToMultiByte(codepage, 0, pw,-1, 0,0, 0,0); if (bsz > 0) { p = new char[bsz]; int rc = WideCharToMultiByte(codepage, 0, pw,-1, p,bsz, 0,0); if (rc != 0) …

Member Avatar for easysir
0
3K
Member Avatar for tformed
Member Avatar for mail2shrid

Try this simplest program, look at these codes on your screen: [code] #include <stdio.h" #include <conio.h> /* Press Esc to quit */ #define ESC 27 int main() { int ch; while ((ch=getch()) != ESC) { printf("%d",ch); while (kbhit()) { printf(" %d",getch()); } printf("\n"); } printf("ESC %d\n",ch); return 0; } [/code] …

Member Avatar for ashok1514
0
4K
Member Avatar for Phaelax

I don't understand why this ancient thread is vivified. It's impossible to get an array size by array parameter only. For slow-witted reanimators: it's impossible in C and C++ to get a size of array argument by this array parameter only. You all reanimators forget that: 1. An array parameter …

Member Avatar for Diego.Corso
0
27K
Member Avatar for CoolAtt

1. Start from [url]http://en.wikipedia.org/wiki/Regular_expression[/url] 2. Select, download and install one of C regex libraries. 3. Get the library manual, read it carefully and see examples in the distributive...

Member Avatar for rubberman
0
236
Member Avatar for mrrko

Face value definition: [url]http://stats.oecd.org/glossary/detail.asp?ID=5945[/url] [url]http://www.sutton.com/dictionary/face+value+of+a+loan[/url]

Member Avatar for Bummpy 1
0
1K
Member Avatar for dooper

Some notes to OP code: Next time (rather always) try to separate interface and calculation (processing) modules (functions). For example, it's a very useful function: [icode]long getJulianDay(int y,int m, int d)[/icode]. You (and others) can use it in console or GUI programs. You can use it in the displayjulianDates function …

Member Avatar for Masterlynx
0
308
Member Avatar for jaepi

It seems this zombi thread was started by incorrect and unclear question then proceeded with answers to another hypothetical questions and now start the next bla bla bla loop... ;) That's my deposit in the discussion of char to int promotion...

Member Avatar for WaltP
0
1K
Member Avatar for BMPaul

Yet another common and portable approach: use ordinar structures to create BMP info then pack them into the final char buffer (use memcpy(buffer+offset,&member,sizeof member), move offset forward and so on). Of course, it's possible to write data to a file stream directly (no need in current write pos forwarding). Add …

Member Avatar for gpyrounakis
0
2K
Member Avatar for Tommybb

If other "modules" (mean and median) look like this function mode I can't imagine how you "have everything working but the mode". 1. It seems you must "find the mean, median and mode of an array of numbers". If so, why you get array values in the function mode body? …

Member Avatar for G-Dog
0
14K
Member Avatar for jaepi

[url]http://opengroup.org/onlinepubs/007908799/xsh/semaphore.h.html[/url]

Member Avatar for sfault
0
634
Member Avatar for RuneFS

Look at [url]http://www.chris-lott.org/resources/cmetrics/[/url] [url]http://www.laatuk.com/tools/metric_tools.html[/url] [url]http://soft.mydiv.net/win/download-Understand-for-Cpp.html[/url] Most of the tools are commercial, sometimes trials are available...

Member Avatar for IssamLahlali
0
118
Member Avatar for kookai

>Here is the shortest code for finding the fibo series I think this code is shorter, don't you? [code=c++] void Fib(int fmax) { int i = 1, f[2] = { 0, 1 }; while (f[i] < fmax) { cout << f[!i] << '\n'; f[i^=1] = *f + f[1]; } } …

Member Avatar for Nick Evan
0
2K
Member Avatar for gyagyus

Can you explain why did you wrote this absolutely senseless expression: [icode]this[i] = &h[/icode]? If you want inherited [icode]operator[][/icode], write [icode](*this)[i][/icode]...

Member Avatar for xth
0
3K
Member Avatar for waldchr

Probably the best place for Dark GDK question is Dark GDK community forum... I can't imagine what's a relation between [icode]#include <conio.h>[/icode] in your modules and errors in Dark GDK files...

Member Avatar for Cosmin871
0
638
Member Avatar for Dark_Omen

Try Ultimate++ RAD suite (it's free; MinGW compiler in bundle): [url]http://www.ultimatepp.org/[/url] I hope, you will get your first GUI application (almost) at once after download and installation...

Member Avatar for kvprajapati
-1
4K
Member Avatar for EngSara

Regrettably, it's impossible to get time interval with microseconds precision from standard C and C++ run-time library calls. The best function in this area is clock() but it yields ticks with OS process sheduler time slice precision (near 10-15 milliseconds in the best case). See your OS manuals: as usually, …

Member Avatar for menauman
0
6K
Member Avatar for rocky2008

1. calloc, malloc, realloc et al: [url]http://irc.essex.ac.uk/www.iota-six.co.uk/c/f7_dynamic_memory_allocation.asp[/url] (or lots of another tutorials on this topic). 2. [icode](type)expression[/icode] called [i]cast[/i]. It forces a conversion of expression value to the type; malloc() returns void* type value (pointer to void) - generic pointer value; char* denotes pointer to char type - so [icode](char*)malloc(n)[/icode] …

Member Avatar for surendra verma
0
177
Member Avatar for christiangirl

Look at heapsort algorithm and implementation tutorial: [url]http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_sorting.aspx#heap[/url] May be it helps...

Member Avatar for budi indri
1
155
Member Avatar for smize33

It's your antiquarian Turbo C 2.0 compiler problem: no // line comments in this ancient C (but not C++ ) language implementation for DOS. Well, use /* */ comments... That's your problem...

Member Avatar for N1GHTS
-2
189
Member Avatar for kutukak

Probably, it's a very interesting story... But what is it: elevator program?!..

Member Avatar for karthikeyanvani
-1
372
Member Avatar for lonely_girl
Re: HELP

Obviously, it's not Pakistan peculiarity, it's some school teachers (and pupils ;) ) feature...

Member Avatar for Adak
0
256
Member Avatar for xcyrus_tan_rx

Please, read this [url]http://www.daniweb.com/forums/announcement8-2.html[/url] and this [url]http://www.daniweb.com/forums/thread78060.html[/url] (especially the last para)...

Member Avatar for cutejhomz
0
106
Member Avatar for drjay1627

[code=c++] std::queue<int> q; q.push(1); q.push(2); q.push(3); int k; for (int i = 0, n = q.size(); i < n; ++i) { std::cout << (k = q.front()) << '\n'; q.pop(); q.push(k); } [/code] That's why I don't like STL container adaptors ;)...

Member Avatar for vijayan121
0
129
Member Avatar for 2008macedonkon3

Some addition: The newest C++ draft standard: [quote] There are three floating point types: float, double, and long double. The type double provides at least as much precision as float, and the type long double provides at least as much precision as double. The set of values of the type …

Member Avatar for Kanoisa
1
2K
Member Avatar for yap.nice

I like Todd Veldhuizen's remark very much ([url]http://www.oonumerics.org/oon/oon-list/archive/0331.html):[/url] [quote] C++ is a chainsaw, a nailgun, a 15-ton bulldozer. [/quote] A toothpick is not so "hard" as a 15-ton bulldozer, right? But is a toolpick better than a bulldozer? It depends...

Member Avatar for akilank
0
159
Member Avatar for natd

Of course, you randomize the number of games too. See default choice (in the inner loop) logic. It increments game value in one or two points (the number depends on random values of myPoint and new sum). You have eight points of game var incrementing on every control path. This …

Member Avatar for smurf6189
0
112
Member Avatar for hitmanner

[code=cplusplus] typedef char Name[41]; Name* name = new Name[501]; ... delete [] name; [/code]

Member Avatar for amin_a
0
357

The End.