1,296 Posted Topics

Member Avatar for mikemea

Well, and what's your problem? Are you sure that telepathy helps me to get the type_of-gas variable declaration and the calcCharges function signature? It seems you have a very informative diagnostic message.

Member Avatar for ArkM
0
77
Member Avatar for atman

Look at [url]http://www.codersource.net/cpp_tutorial_this_pointer.html[/url]

Member Avatar for siddhant3s
0
143
Member Avatar for halfnode
Member Avatar for ArkM
1
199
Member Avatar for C++.java

1. Next time use code tag: [noparse][code=c++] source [/code][/noparse] 2. Alas, you forgot (;)) that case labels are constant expressions of integral (for example, an integer 123 or a single char 'x') or enumeration type. You can't type enumeration constants directly because no overloaded >> operator for enumerations. Input text …

Member Avatar for ArkM
0
112
Member Avatar for mushbucket

>I'm limited as to what I can give you (security reasons) Hehe, the Top Secret Addendum to the C++ Language ;) It seems nobody can tell you anything with unknown types of state.Variable and saveloadtypes array or strTmp and strBuf scopes or correct pFrame and m_pAppWnd pointer values... There are …

Member Avatar for mushbucket
0
202
Member Avatar for blerina12

Please, explain these evidently wrong statements: [code=c++] pattern = new char*[size]; pattern = p; ( pattern[i] = new char[length(p, i)] )= p[i]; [/code] See what happens: - You create uninitialized array of pointers to char. - The next statement overwrite a pointer to this array (memory leak) by the parameter …

Member Avatar for blerina12
0
325
Member Avatar for winrawr

What's a problem? Class B must be known before A::setErrorMessage definition - that's all. Collect both class definitions in .h file, include it in .cpp file with class A implementation - or simply move up class B definition in your main module just before A::setErrorMessage definition... Apropos, you have posted …

Member Avatar for winrawr
0
167
Member Avatar for daviddoria

>Which is the most modern (ie c++) way to do this? To do - what? What's a true problem? "Returning a pointer" is not a problem. All snippets in the original post describes different program cases. It seems the right question only helps to correct this bla-bla-bla thread direction ;)...

Member Avatar for ArkM
0
86
Member Avatar for hurbano

1. Move all function definitions to a separate .cpp file (and never, ever include them in .h files, except class templates - but it's the other story). 2. Think about [icode]month[i] = !month[i][/icode]

Member Avatar for hurbano
0
2K
Member Avatar for Georges5

This fseek32 function is an implementation-dependent nonstandard trick: standard C RTL fseek/ftell expects/returns long int (signed 32-bit for VC++) values only. I think it can't move file pointers over 31-bit boundary (you see that). Try to rewrite fseek32 with VC++ non-standard _fseeki64 function with long long (64-bit, old typename __int64) …

Member Avatar for Georges5
0
249
Member Avatar for viki0077

Yet another tip: the only correct statement is [icode]return *this;[/icode] ;)

Member Avatar for ArkM
0
86
Member Avatar for viki0077

What's a tremendous, innovative C++ syntax! ;) Are you sure that it's DaniWeb members homework?

Member Avatar for viki0077
0
122
Member Avatar for jared717

>I found it and don't understand how to run it. When I do it says... OK, this program can't print this message so I suspect that you have tried to print the 1st line of this text as a command string ;) You don't understand how to run it but …

Member Avatar for abhishaki
0
195
Member Avatar for bhavya_talluri

Have a look at the brilliant tutorial on sorting: [url]http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_sorting.aspx#heap[/url]

Member Avatar for abhishaki
0
115
Member Avatar for cproud21

Probably the simplest (and dirty) method: pass month array into the bSort function and swap its elements at the same time as rain elements swapped...

Member Avatar for rudasi
0
120
Member Avatar for xonxon

[QUOTE=xonxon;803981]i am new here,still not familiar with the code.So my Question is i have been given an assignment on how to design a class,pointType , that can store and process a point in the x-y plane. The program should perform setting and printing coordinate of the point, returning the x- …

Member Avatar for Stefano Mtangoo
0
152
Member Avatar for shasha821110

Don't waste a time with PowerPoint internal formats (especially as PowerPoint is not an analytical MS Office component). Better think about proper export formats: CSV and graphics files (png, gif, jpeg etc). There are lots of ready to use packages to create pictures (with diagrams). It's so easy to import …

Member Avatar for shasha821110
0
150
Member Avatar for keyser soze

[QUOTE=MosaicFuneral;805059]... And I'm sure you'll need more than one string to store a whole page in.[/QUOTE] What's a problem? For example, in VC++ [icode]source.max_size()[/icode] for [icode]std::string source[/icode] is equal to 4294967294 bytes ;)

Member Avatar for ArkM
0
120
Member Avatar for BranRam

Regrettably, no need to criticize or edit this code. Yes, it's completely (syntactically and semantically) wrong. It seems the only medicine is to rewrite it from the scratch. Better try to define correct (and useful) class Poly specifications. For example, either the next two strings (or numbers? ) define the …

Member Avatar for ArkM
0
86
Member Avatar for uhguy77017

Some melancholy remarks: The most serious defect of strtok-based CSV parsing is that strtok skips null values. For example, in the line [b]"1st,,3rd,"[/b] strtok selects only two tokens: [b]1st[/b] and [b]3rd[/b]. In practice most of CSV exporters (DBMS especially) write this line for four data fields tuple (record) with null …

Member Avatar for ArkM
0
186
Member Avatar for VBNick

You are still mixing declarations and definitions up. Each variable in C++ can have multiple (identical) declarations but should have one and only one definition. This [b]one definition rule[/b] was broken. See [url]http://en.wikipedia.org/wiki/One_Definition_Rule[/url] There are DEFINITIONS of global variables: [code=C++] CAMERA camera; // Allocate static memory for these variables OBJECT …

Member Avatar for VBNick
0
298
Member Avatar for winrawr

Look at: [url]http://www.cprogramming.com/tutorial/c/lesson17.html[/url] [url]http://en.wikipedia.org/wiki/Stdarg.h[/url] And never do that, it's a way to nowhere: - No type check (evidently why) for variadic argument lists. - No way to check up the end of argument list in called function

Member Avatar for ArkM
0
513
Member Avatar for Innercoder76

Well, have you ever compile this source? If so, did you ever read compiler diagnostic messages? You declare showSongList as a function with two parameters but you are trying to call it without arguments. Where is a definition of an array of Songs? Why you declare TWO different title entities …

Member Avatar for ArkM
0
100
Member Avatar for RexxX

It seems both methods are worst ;) Think about another (more flexible and robust) approach: [code=c] typedef struct sData { /* loaded data description/manipulation */ /* totally dynamics (lists, realloc's etc) */ } Data; /* User interface to the Data storage: */ /** Initialize Data structure to process data */ …

Member Avatar for Ancient Dragon
0
110
Member Avatar for omdnaik

[QUOTE=omdnaik;802588]Hi friends... Can any one give me some tips or logic for dynamically defining a structure in C...[/QUOTE] Can you give me an example of [i]dynamically defining structure in C[/i]? Structure [b]definition[/b] in C looks like (in source code): [code=c] struct tag { /* That's a structure definition! */ }; …

Member Avatar for ArkM
0
119
Member Avatar for kjiu
Member Avatar for ArkM
0
68
Member Avatar for ithelp
Member Avatar for death_oclock
0
5K
Member Avatar for krispygrimace

Contrary to your source comments, the class p2dArray has no proper copy constructor(s). You define (wrong) assignment operator but don't define explicit copy constructor. A copy constructor must have (as usually) the signature: [code=c++] p2dArray::p2dArray(const p2dArray&); [/code] No such member declared in your class but default copy contructor (copy member …

Member Avatar for krispygrimace
0
169
Member Avatar for guest7

Don't forget to clear file state if eof was reached: [code=c++] ... read file until eof // Now f is in fail() and eof(0 state... f.clear(); // Now f is capable to seek... f.seekg(0); ... read again ... [/code]

Member Avatar for guest7
0
2K
Member Avatar for Everlong

Use the classic recursive solution approach. Suppose you (your traverse algorithm, of course) are standing at the position (i,j) - level i (from 0 to m-1, up to bottom) column j (from 0 to n-1, left to right). That's a current point of your downward traversal, print it. Now you …

Member Avatar for Everlong
0
227
Member Avatar for cassie_sanford

Try this approach: [code=c++] std::string S(double sum) { std::ostringstream s; s << '$' << std::fixed << std::setprecision(2) << sum; return s.str(); } ... cout << "County Sales Tax: " << setw(12) << S(countySalesTax) << endl; ... [/code]

Member Avatar for vmanes
0
111
Member Avatar for OrionImprisoned
Member Avatar for OrionImprisoned
0
261
Member Avatar for massivefermion

Of course, no way to do that in platform-independent manner. Probably the simplest progress bar surrogate for console applications is conio.h based class with feedback call from the (silent) main loop. Try this improvisation: [code=c++] /// Progress indicator console surrogate. /// Place in conticker.h (no dependencies) class ConTicker { public: …

Member Avatar for ArkM
0
138
Member Avatar for bemo55

Have a look at the excellent tutorial on the topic: [url]http://eternallyconfuzzled.com/tuts/languages/jsw_tut_pointers.aspx[/url]

Member Avatar for ArkM
0
108
Member Avatar for ozan

My 2 ( may be 3 ) cents: Look at: [url]http://en.wikipedia.org/wiki/Matrix_square_root[/url] [url]http://www.newton.dep.anl.gov/askasci/math99/math99208.htm[/url] See also an interesting discussion on the topic: [url]http://yarchive.net/comp/sqrtm.html[/url]

Member Avatar for ArkM
0
165
Member Avatar for drjay1627

[QUOTE=nucleon;799762]You need to increment the array index to point to the next element for each character read. Here's an example. [code] #include <stdio.h> #define SIZE 1000 int main() { int c, n, i; char a[SIZE]; FILE *file; file = fopen ("filename.txt", "r"); n = 0; while ((c = getc (file)) …

Member Avatar for drjay1627
0
106
Member Avatar for hybrid87

[QUOTE=hybrid87;801313]why do you bother sending this stupid links if you dont have any answer dont reply to this thread. and i guess you didnt read smart answering thread.[/QUOTE] You present a lots of garbage unformatted code, can't explain your problem and now post so defiant message on the 100% correct …

Member Avatar for Freaky_Chris
0
191
Member Avatar for iansane

[QUOTE=smithss;800872]Hey, I was trying to write something to help you and got confused myself by this output. May be someone can take a look at this too. Its all related so I'm not starting a new thread [code=c++] #include <iostream> #include <iomanip> int main() { std::cout << std::setprecision(2) << std::fixed …

Member Avatar for vmanes
0
767
Member Avatar for En-Motion
Member Avatar for En-Motion
0
1K
Member Avatar for NenadL

1. Use [b]code[/b] tags properly: [noparse][code=c] sources... [/code][/noparse] 2. Well, and WHAT's your problem?

Member Avatar for Ancient Dragon
0
376
Member Avatar for Jayrrus

1. Initialize an empty tree: [code=c++] TreeNode* root = 0; [/code] You initialize root with new TreeNode which contains garbage (uninitialized) pointers. 2. Discard a strange call of Insert(). No such function in your source. 3. Think about a right place for Insert (root,info) call.

Member Avatar for ArkM
0
136
Member Avatar for monkey_king

[QUOTE=monkey_king;800004]Hey, does anyone know if it possible to have something like [CODE] #DEFINE NUM_DEC 4 printf("This is your value:%.NUM_DECf\n"); [/CODE] [/QUOTE] Something like?.. No, it's impossible: no printed value presented ;) [code=c] printf("This is your value: %.*f\n",NUM_DEC,3.14159265358); [/code]

Member Avatar for Prabakar
0
98
Member Avatar for kux

[QUOTE=kux;801037]ok, so visual C++ is not C99 compliant, but I was wondering how can I access fixed bit length integer types as the one defined in stdint.h (intN_t). [/QUOTE] Try this: [url]http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2006-December/020305.html[/url] Or try to adopt stdint.h and other C99 stuff from the MinGW compiler (check MinGW license rules carefully)...

Member Avatar for ArkM
0
116
Member Avatar for flip.phinoi

Please, post your code again with [b]code[/b] tags: [noparse][code=c++] sources [/code][/noparse] It's impossible to read unformatted raw codes... Read this before: [url]http://www.daniweb.com/forums/announcement8-3.html[/url]

Member Avatar for WaltP
0
287
Member Avatar for bubun1979

[QUOTE=Comatose;800389]Show me the code you have, and I can see what help I can offer once I see what effort you have applied. Step 1. Read argv[0]. argv[0] is the name of the file Step 2. Check that argv[0] file still exists (yeah, it should) step 3. Open the file …

Member Avatar for ArkM
0
200
Member Avatar for T.N.Sharma

Don't waste a time on studies of this incorrect program behaviour. The fatal defect of your class Node manipulations approach is that std::vector is an intrusive container. It has its own copies of all elements. In the function Bi_tree you assign node addresses and manipulate with vector contents at the …

Member Avatar for T.N.Sharma
0
138
Member Avatar for CPPRULZ

[QUOTE=death_oclock;799773]No, the copy constructor is used only when called explicitly or when an object is being [I]initialized[/I]. You could, however, have the assignment operator call your copy constructor.[/QUOTE] Yet another context where copy constructor works: [code=c++] class C {...}; void f(C); // by value ... C c; f(c); // <= …

Member Avatar for MMahmoud
0
149
Member Avatar for massivefermion

It's possible (to some extent) in Algol 68. Download Algol 68 interpreter and try to make the most cryptic code in the World: ;) [url]http://www.xs4all.nl/~jmvdveer/algol.html[/url]

Member Avatar for ArkM
0
92
Member Avatar for jraven1

[code=c++] inline bool isUint(const std::string& s) { return s.find_first_not_of("0123456789") == std::string::npos; } [/code]

Member Avatar for ArkM
0
277
Member Avatar for abhi.nalluri
Member Avatar for abhi.nalluri
0
438

The End.