1,296 Posted Topics

Member Avatar for slayman89

Look at the trailed backslash: [code=cplusplus] // Test constructors\ Complex c1, c2(6.35), c3(-5.5, 3.0); [/code] It's a continuation-line character in C and C++. The next line now is a part of a single-line comment, so you don't declare c1, c2 and c2 variables! The 2nd error is hidden (for the …

Member Avatar for slayman89
0
100
Member Avatar for Dr_Pepper
Member Avatar for cperepelitsa
Member Avatar for ArkM
0
152
Member Avatar for chococrack

The special pointer [icode]this[/icode] has type [icode]Class*const[/icode] (not Class*) so you can't pass [icode]this[/icode] as an argument to myFunction. It seems the myfunction member has a slightly unusual signature with the 1st parameter of type "a reference to a pointer to myClass<temp_Type>". Can you explain what do you want to …

Member Avatar for Narue
0
280
Member Avatar for jeevsmyd

It seems now this thread looks like a horrible mash of valued receipts and consumate gibberish advices. You can't use windows.h header with aged 16-bit Turbo C++ 3.0 compiler. You can't use goto statement to jump into the main function from outside its body. You can't do the simplest thing: …

Member Avatar for Sci@phy
0
655
Member Avatar for adityasaten

Good idea. Optimized solution (to have a star easely, faster with factor 10 or more): [code=c] printf( "*\n" "***\n" "*****\n" "*******\n" "*********\n" ); [/code] Premium edition for lazy programmers...

Member Avatar for abhijeetcn
0
119
Member Avatar for J-son

Some additions: 1. If no returned type explicitly defined in C and C++, int assumed (backward compatibility with Stone Age of the C language). Of course, now it's bad style. 2. Effect of input stream fflush is not defined in the C language. 3. Declare name and dep members as …

Member Avatar for abhijeetcn
0
148
Member Avatar for jammy's

Please, don't waste your time on these unintelligible posts. Look at [url]http://www.daniweb.com/forums/thread78223.html[/url]

Member Avatar for ArkM
0
126
Member Avatar for jammy's

Congratulation! You ignore all this forum rules: [url]http://www.daniweb.com/forums/thread78223.html[/url]

Member Avatar for Ancient Dragon
0
87
Member Avatar for mugun

I think it's a problem with your understanding of the std::vector class properties. Before using v[10] you must initialize v[10] vector element. For example, you can declare [icode]std::vector<type> v(N)[/icode] or call [icode]v.push_back(something)[/icode] at least N times or call [icode]v.resize(N)[/icode] where N >= 11.

Member Avatar for ArkM
-1
142
Member Avatar for sanchyvil

Your Windows installation does not know where is the g++ executable. See [url]https://users.cs.jmu.edu/bernstdh/web/common/help/cpp_mingw-faq.php[/url]

Member Avatar for sanchyvil
0
353
Member Avatar for sunveer

Look at [url]http://en.wikipedia.org/wiki/Triangular_matrix[/url]

Member Avatar for ArkM
0
97
Member Avatar for STUDENT#101

There is a wonderful choice in VS 2008 File menu: File|New|Project From Existing Code... Always specify Visual Studio version if you want help on IDE...

Member Avatar for AceofSpades19
0
150
Member Avatar for EBaller55

The for statement syntax: [code] for (for-init-statement condition(opt); expression) for-init-statement:: expression-statement simple-declaration expression-statement:: expression(opt) ; [/code] Informally simple-declaration is well-known type names-with-possible-initializators construct. The semicolon token terminates construct in C++. Obviously, [icode]int i = 0, int j = 0;[/icode] and especially [icode]int i = 0, double d = 1;[/icode] are …

Member Avatar for ArkM
0
253
Member Avatar for anuj_sharma

Well, go to Java basics then go to C# basics... What's a pleasure to live in the city where no buildings, foundations only... ;)

Member Avatar for Narue
0
99
Member Avatar for Jennifer84

About this thread starting question: look at my posts in solved threads (two month ago): [url]http://www.daniweb.com/forums/thread136351.html[/url] [url]http://www.daniweb.com/forums/thread137814.html[/url]

Member Avatar for Jennifer84
0
169
Member Avatar for mars key

Use outtext or outtextxy functions. Prepare a text string with [code=c] char text[80]; /* */ ... sprintf(text," sum = %d",x); outtext(text); [/code] See BGI functions manual. Online version for extended BGI: [url]http://www.cs.colorado.edu/~main/cs1300/doc/bgi/index.html[/url] Search Google for more info.

Member Avatar for ArkM
0
127
Member Avatar for blackryu21

Yet another orphan post (see [url]http://www.daniweb.com/forums/thread148725.html[/url] - 3 hours later). Alas, the post header does not bear a relation to the true problem (as in the 2nd thread too ;)). Don't forget to mark this orphan as solved too when you will get an answer to the 2nd thread (better …

Member Avatar for ArkM
0
102
Member Avatar for cuthien

Look at the statement: [code=cplusplus] outFile << aa << endl; [/code] <<endl prints newline and flushes output buffer. That's why your program prints every char on the new line...

Member Avatar for gregorynoob
1
95
Member Avatar for blackryu21

Regrettably no background demons which capable to trace your Selection_sort array elements shuffling. You must change Selection_sort code to assign not only elements of processed array but also synchronously move its initial position in "parallel array". Add 4th array parameter to Selection_sort function (and add corresponded temp variables for pivot, …

Member Avatar for ArkM
0
503
Member Avatar for r00ster

You don't pass "char by reference" to these functions. You pass (as usually by value, not by reference) a pointer to char: feel the difference. Look at "pass char by reference" case: [code=cplusplus] void PassCharByRef(char& c); [/code] Don't mix distinct types: array of char and char. About array case: there …

Member Avatar for ArkM
0
97
Member Avatar for NinjaLink

It's funny that you program prints anything: the only purpose of this code now is the program stack corruption. The 1st index in C and C++ arrays is 0 (not 1!). All for loops in your input routines are wrong. See also finalgrade function: not all control paths return a …

Member Avatar for NinjaLink
0
164
Member Avatar for rrreeefff

1. Better follow standard pow pattern: use double type for argument and returned value. 2. Some useful method: extract recursive part to reduce a number of operators in recursion: [code=c] static double powrec(double x, int n) { return n? x * powrec(x,n-1): 1.0; } double powint(double x, int n) { …

Member Avatar for rrreeefff
0
155
Member Avatar for cw1184

See, for example: [url]http://www.eldar.org/~ben/convert/c_f.html[/url] but don't forget: you must use double arithmetic and constants ;).

Member Avatar for cw1184
0
209
Member Avatar for meddlepal

It seems your Cells class looks like a harmless caricature of OOP. The file name is a hidden builtin string literal, grid parameters depends on module scope constant int values, the only interface member function unexpectedly prints to cout builtin and rigid messages (I want to count only, not to …

Member Avatar for ArkM
0
235
Member Avatar for gregorynoob

What's a funny thing - decimal rounding of binary floats... May be it stands in good steads ;): [code=c] /** * 2008-10-01 Beta version. No warranties... * Rounding functions freeware mini-package. * About rounding forms and MS rounding stuff * see http://support.microsoft.com/kb/196652 * Dependencies: <math.h> <float.h> * Languages: standard C …

Member Avatar for ArkM
0
180
Member Avatar for geemicah

How funny: the grade_equivalent function performs a long chain of if-elses to get an exact floating-point equivalent of grade then return integer value! And where is your 1.25, 1.75 and other non-integer values after that? Moreover, grade_equivalent(75) == 3 but it returns 5 for 76, 77 and 78...

Member Avatar for ArkM
0
146
Member Avatar for cam875

It's impossible to compile this code: [icode]char binary[ElementAmount];[/icode] declaraion where ElementAmount is not initialized variable is wrong. Post another "0 warning 0 errors" snippet ;)...

Member Avatar for cam875
0
61
Member Avatar for andyT

What's a hot thread!.. I don't know why you want to copy vector contents into dynamically allocated array. I think it's not so good idea: you get a new pointer to the heap then have a new trouble with its deallocation in a proper moment. You always can obtain a …

Member Avatar for andyT
0
227
Member Avatar for Bigboy06

1. Always use tag CODE to post your snippets: [noparse][code=cplusplus] your code [/code][/noparse] 2. Senseless member function does not assign any value to month: [code=cplusplus] void Month::Input(istream& in) { char first,second,third; int number_month; char c; c=in.peek(); if ( (c > '0') && (c <= '9')) { in >> number_month; Month(nuber_month); …

Member Avatar for Salem
0
144
Member Avatar for vladdy19

No, it's absolutely illegal expression (or illegal declarator). The operator & needs lvalue argument but returns so called rvalue (of right part). In other words, the argument of operator & must be a function or an object in memory but it returns a value (not an object or a function). …

Member Avatar for ArkM
0
65
Member Avatar for Bigboy06

1. Avoid these horrible switch cascades (as in Month::Output) where possible (it's that case). 2. Don't add unnecessary dependencies in your class design. For example, your Month class is dependent of ostreams via Month::Output(). Why? Better add some useful functionalities (and see point #1 above): [code=cplusplus] const char* Month:: Name() …

Member Avatar for ArkM
0
337
Member Avatar for launic

See hash_map::find description with an example: [url]http://msdn.microsoft.com/en-us/library/525kffzd.aspx[/url] About hash_map class in VC++: [url]http://msdn.microsoft.com/en-us/library/0d462wfh.aspx[/url]

Member Avatar for sidatra79
0
197
Member Avatar for amrith92

Why you include readcharacter.cpp in the "other file"? It seems you don't understand the principle of a splitting a program to separate modules. Now you have ReadCharacter function body in both modules. Of course, the linker (it's a part of your programming system: linker builds exe from separately compiled modules) …

Member Avatar for TheBeast32
0
162
Member Avatar for ohnomis

>you can actually calculate a more accurate solution without using a power function Probably you can do that but not with this series. You must calculate over 250 terms to achieve log(result) == 156 (slower than pow with factor ~25) but pow approximation of e^156 is better than sum of …

Member Avatar for ohnomis
0
534
Member Avatar for volscolts16

As far as I know LNK1120 in MS VC gives a count of unresolved externals (LNK2019 error: unresolved external symnol found in the function...). Both errors are common. No definition for external symbol. So we can't help you with error numbers only...

Member Avatar for grumpier
0
100
Member Avatar for boncher

Better explain what problems you have with iterators. Do you want to invent quadrate wheels?..

Member Avatar for ArkM
0
112
Member Avatar for clive2008

An extremely ineffective algorithm. It has O(M*N) complexity and can't detect line swapping and line deleting and inserting... Think about better algorithm now (for example, load a file into map<string,vector<int>> or what else...

Member Avatar for ArkM
0
74
Member Avatar for TooMpa

As far as I know you need "t:" getopt option. May be I'm wrong (I don't like getopt ;)). See [url]http://www.gnu.org/software/libtool/manual/libc/Using-Getopt.html#Using-Getopt[/url]

Member Avatar for ssharish2005
0
166
Member Avatar for VernonDozier

Thank you all participants for a very interesting discussion in the thread. Some additions: Let's remember what is a copy constructor in C++. Copy constructors are (C++ Std, 12.8): [quote]A non-template constructor for class X is a copy constructor if its first parameter is of type X&, const X&, volatile …

Member Avatar for VernonDozier
0
424
Member Avatar for Strat79

Regrettably I have no time now to inspect your code more carefully but your list() initialization function is obviously wrong. It does initialize nothing because of it modifies by value copies of head/tail pointers only. It must have double indirection parameters to modify its arguments.

Member Avatar for ahamed101
0
238
Member Avatar for san_sarangkar

However take into account the C++ Standard, 3.6.2 (3): [quote]It is implementation-defined whether or not the dynamic initialization (8.5, 9.4, 12.1, 12.6.1) of an object of namespace scope is done before the first statement of main. If the initialization is deferred to some point in time after the first statement …

Member Avatar for ArkM
0
321
Member Avatar for ashkash

I have one and only but brilliant idea: get your textbook and read about: 1. Hexadecimal int and char literals (0xBC and '\xBC', for example). 2. Shift operators << and >> 3. Logical or/and operators | and & That's all, folks...

Member Avatar for rpiper138
0
2K
Member Avatar for Jennifer84

The only addition to Ancient Dragon's C stream library method: add setvbuf call after fopen: [code=cplusplus] const size_t BSZ = 1024*32 // or more ... FILE* fp = fopen("..\\TextFile1.txt", "r"); if (fp) { setvbuf(fp,0,_IOFBF,BSZ); // No need to free buffers explicitly ... [/code] Default stream buffer size is too small …

Member Avatar for Jennifer84
0
7K
Member Avatar for godlike111

Because of no total linear memory space concept in platform-independent C++ language. Moreover, no assumption that pointer binary representations are positive (or negative or even if they are valid) integer values. For example, visual pointer representation on some platforms looks like XXXX:YYYY - is it integer? You can use reinterpret_cast<> …

Member Avatar for Narue
0
2K
Member Avatar for jthechemist

Look at your class constructor: [code=cplusplus] jStack<T>(T* element) { LinkedNode<T> node(element); top = &node; count = 1; } [/code] Now what happens: you create LOCAL (in the stack) variable node and place its address (the pointer to local node var) in the top pointer (don't forget: a constructor is a …

Member Avatar for ArkM
0
115
Member Avatar for marivic

Hmm... Many years ago I have implemented a complete POS system for a very good POS terminal in Turbo C 2.0... ~30000 lines of source codes... ~3 month of 24/7 works...

Member Avatar for marivic
0
384
Member Avatar for chern4ever

Of course, you can compare minutes and seconds but it's senseless operation. For examples, you have 10 dollars and I have 11 cents. Let's compare our capitals... OK, 11 > 10 - I'm so reach, poor chern4ever... You can properly compare values of [icode]60.0*minutes + seconds[/icode].

Member Avatar for ArkM
0
78
Member Avatar for asifjavaid

Alas, you write itoa result to nowhere. Just before itoa call YOU say: my hexData pointer points to NOWHERE (NULL is this NOWHERE). You must pass a real memory pointer to itoa. Declare a char array or allocate memory chunk by new operator. Or (better) reread your C or C++ …

Member Avatar for ArkM
0
173
Member Avatar for JONZ

Copy/paste all commentaries from the source: it's your desired pseudocode ;)...

Member Avatar for rpiper138
0
175

The End.