1,296 Posted Topics
Re: 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. | |
Re: Look at [url]http://www.codersource.net/cpp_tutorial_this_pointer.html[/url] | |
Re: [code=c++] if (padN > 0) string1.insert(0,padN,' '); [/code] ;) | |
Re: 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 … | |
Re: >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 … | |
Re: 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 … | |
Re: 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 … | |
Re: >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 ;)... | |
Re: 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] | |
Re: 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) … | |
Re: Yet another tip: the only correct statement is [icode]return *this;[/icode] ;) | |
Re: What's a tremendous, innovative C++ syntax! ;) Are you sure that it's DaniWeb members homework? | |
Re: >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 … | |
Re: Have a look at the brilliant tutorial on sorting: [url]http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_sorting.aspx#heap[/url] | |
Re: 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... | |
Re: [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- … | |
Re: 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 … | |
Re: [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 ;) | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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 | |
Re: 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 … | |
Re: 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 */ … | |
Re: [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! */ }; … | |
| |
Re: What C compiler are you using? What's this pragma format description in the compiler manuals? | |
Re: 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 … | |
Re: 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] | |
Re: 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 … | |
Re: 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] | |
Re: Can you read so fantastically indented program source? Alas, I can't do it :( | |
Re: 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: … | |
Re: Have a look at the excellent tutorial on the topic: [url]http://eternallyconfuzzled.com/tuts/languages/jsw_tut_pointers.aspx[/url] | |
Re: 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] | |
Re: [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)) … | |
Re: [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 … | |
Re: [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 … | |
Re: You forgot to add Point() constructor declaration in the class Point definition. Do it. | |
Re: 1. Use [b]code[/b] tags properly: [noparse][code=c] sources... [/code][/noparse] 2. Well, and WHAT's your problem? | |
Re: 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. | |
Re: [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] | |
Re: [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)... | |
![]() | Re: 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] |
Re: [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 … | |
Re: 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 … | |
Re: [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); // <= … | |
Re: 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] | |
Re: [code=c++] inline bool isUint(const std::string& s) { return s.find_first_not_of("0123456789") == std::string::npos; } [/code] | |
Re: Did you forget to SET timeout parameters via SetCommTimeouts call?.. |
The End.