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
~674.17K People Reached
Favorite Tags
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
931
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
968
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
316
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
825
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
284
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
307
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
708
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
515
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
609
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
232
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
305
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