556 Posted Topics
Re: Well assuming that you don't just want to stick with VB.NET in your position I would go for C# which is also a .NET language so uses the same class library as VB.NET. | |
Re: * Always use the double type not the float type unless you have a comunicable reason for needing to use float (like it's an embedded platformwithout much memory or the question you are answering specifies use of float). * Line 9 `for(k=1;k<=n;k++)` is poor form, you k is an unsigned … | |
Consider this piece of code class Example { }; class ExampleAccessor { public: struct ConstructionFlag { ConstructionFlag() { } ~ConstructionFlag() { } }; explicit ExampleAccessor(Example&) { } ExampleAccessor(Example&, const ConstructionFlag&) { } }; int main() { ExampleAccessor accessor(ExampleAccessor::ConstructionFlag()); } Which is the minimal example of something I found in our … | |
![]() | Re: I do not believe this char* timein[5], timeout[5], p; is doing what you think. It creates timein as an array of 5 pointers to char (char *) timeout as an array of 5 char p as a char. You should try char timein[5], timeout[5], *p; or better still only declare … |
Re: It probably is showing you all the spaces it is just that it is using a variable width font and so thoses spaces are not very wide. | |
Re: Line 16, the parameter to Thread is not named. Line 18, third parameter to _beginthreadex consists of '(__stdcall*) (void *)' which is not a valid anything, perhaps it was meant to be the unnamed function parameter? | |
Re: To start with the reason you have to use classes for a program that you could just write in main is so that you get used to classes. While you are studying all of you exercises are contived and often fairly small you do them to learn the techniques that … | |
Re: Get your assignment opertators and constructors correct and copying one to the other becomes a simple std::copy call. #include <vector> #include <string> #include <algorithm> #include <iterator> using std::vector; using std::string; struct MainStruct { public: double a; double b; double c; double d; unsigned e; unsigned f; string g; MainStruct() : … | |
Re: Code seems to work fine for me except that if there is not a new line at the end of the last number in the list your first loop produces a count that is 1 too small. | |
Re: itemIdInFile is not declared anywhere in the code you have supplied. Most of your member functions are not declared in the header you supplied. I surmise that you have not posted your actual code because the code you have posted would not compile and you imply that you can compile … | |
Re: If you had an extra blank line ((or even a few spaces at the end of the last line) at the end of you dtata file then the !eof end condition in the while loop wouldn't be triggered, however the the request for input in ReadMixedExp would fail. In this … | |
Re: For many IDEs this is because you are not running the program but debugging it (running it in the debugger). The debugger assumes that you will have added a break point if you want to stop so it doesn't both stopping after program execution. In stead of debugging the program … | |
Re: On line 1 when reading "12.4find" the first time it reads the line it reads the 12.4 and converts it to a float(? or double you don't say) and stores it in f. The next time round the loop the next thing to read is "find", you request that this … | |
![]() | Re: So firstly you need to have an idea of what you expect your program to output, you haven't told us so it is rather hard for us to guess. Secondly if the program is not performing as expected you need to find where the bug is, you could try examining … |
Re: The problem is everywhere you `new Node<TYPE>`. The Node<Type> constructor does not set m_NextElement and everywhere you new it you don't set it either so in your list the final element in the list always has an invalid m_NextElement. When calling the list destructor this causes your program to exhibit … | |
Re: The answer is you probably can't with any efficiency. The thing is to perform an interpolation you have to have random access to your data, that is you need to be able to directly address an member of the data. In a linked list you don't have random access, you … | |
Re: 1. use a vector not an array or alternitively 2. Where you call your functions, example line 32, pass the number of items used in the array rather than the size of the whole array | |
Re: I am slightly surprised that you have declared NumericArray as a template I would have expected something similar to // This is the interface for the derived class class NumericArray: public Array<double,int>{ ... } That is the derived class is an implementation of the template for a given type, or … | |
Re: It is easiest to understand what << and >> do when you consider a number as a binary value (which is where convertion between binary and decimal come into it). This is because these are bitwise operators (2 of several), that is when they operate they consider individual bits of … | |
Re: Line 8 initialising b to 0 means that at line 9 you get a divide by zero error while trying to get the remainder after dividing a by b. | |
Re: That doesn't fix your problem it hides it. The problem is in your for loop at lines 23, 28, 29, 31 and 32 where you access `pArray[s + 1]` and `names[s + 1]`. Since the loop is written `for(int s = 0; s < count; s++)` in the final iteration … | |
Re: I assume you mean at line 11, that is because operator>> on an istream into a string uses any white space as a separator, it is specifically coded to only read up to the space. If you want to get an entire line into a string use std::getline, declared in … | |
Re: I assume you are missing a 0 between the first `? :`. You could use the modulous (%) operator rather than a second test. Whether this is better rather depends on the processor it is running on though Clip(int Val) { return ((curr < 0) ? 0 : (curr %= … | |
Re: No there is only ever a single destructor ~a() { } It never takes any parameters. This makes sense, the reason that you have parameterised constructors is that you may wish to initialise your object in several different ways, but when you destroy your object there is no need for … | |
Re: parameter row is unused. The function returns a pointer to an object, arr, that is on the stack and that will therefore be deleted once the function exits which is almost certainly likely to produce undefined behaviour. Line 10 and 12 are equivilent to `return arr`; | |
Re: You need to install Java on your machine. Also are you sure your path should contain C:\MinGW\i686-pc-mingw32\lib and not C:\MinGW\i686-pc-mingw32\bin | |
Re: changerSignal is not a member of QLabel, it is a member of FenPrincipale but at line 173 you try this `QObject::connect(labelAfficherStatsHero[1], SIGNAL(changerSignal()), signalStatsHero , SLOT(heroNomChanger()));` labelAfficherStatsHero[1] is a QLabel and therefore only supports the signals defined for QLabel, that is void QLabel linkActivated (const QString &link ) void QLabel linkHovered … | |
Re: At line 14 you still have a and b declared as int but you scanf them as floats at line 16 which will produce the strange results you are seeing. | |
Re: The problem is not to do with you code it is to do with prototype, consider this program #include <iostream> class Test { public: const char *text() const throw() { return "Const test"; } const char *text() throw() { return "Non-Const test"; } }; int main() { Test t; const … | |
Given this header // header.h #include <string> namespace company { namespace module { class ProjectConstants { public: static const int CONSTANT1; static const std::string CONSTANT2; }; } } and this source file // header.cpp #include "header.h" using company::module::ProjectConstants; const int ProjectConstants::CONSTANT1 = 10; const std::string ProjectConstants::CONSTANT2("Hello World"); Are ProjectConstants::CONSTANT1 and … | |
Re: When I compile this I get `warning: ISO C++ forbids zero-size array 'a'` although I am using the 2003 standard. You have declared a zero size array in the class therefore the class has no data and is zero-sized. Since the array has members it appears that the compiler (mine … | |
Re: Basically a floating point number is an approximation and if nothing else is specified then floating point constants have the type double. This means that in the line `float f2=14.385;` the compile converted the double constant 14.385 to a float and then assigned it to f2; then in `if(f2==14.385)`, since … | |
Re: The 'left to right' order you refer to is the operators associativity. This is nothing to do with what order the operands are evaluated in but is to do with the order multiple operators of the same preceedence are evaluated in, for example the left-to-right associativity of + and -, … | |
Re: There are 2 things describing how/what order operators in an expression are evaluated; preceddence and associativity. It is important to remeber that associativity is only ever applied to a series of operators of the same preceedence, that is in the line `a = b + c;` the associativity of the … | |
Re: 1. There is not other option in your printf statement, the only way to output a value multiple times is to put in multiple times on the parameter list. 2. Not surprised that q has odd values. You have not included a definition of store_temp or store_other but they both … | |
Re: In the main function they are not pointers they are arrays and the size of an array is the sum of the size of each its elements. When you divide by the size of a single element you get the number of elements in the array. So in this code … | |
Re: You can increment using something like this assuming a grey code number with n bits numbered from LSB 0 to MSB n-1 Get the count of the number of bits set to 1 if count is even invert bit 0 else set j = the number of the least significant … | |
Re: free has to be called with the pointer you wish to free so the syntax at line 30 is wrong. `comp` is never used you can remove lines 13 and 17 without affecting your program. line2 20, 21 and 23 really make no sense. What you want to do is … | |
Re: Actually the standard says that use of any automatic variable before it has been either initialised or assigned is undefined behaviour, which as we all know is bad. | |
Re: <pedantic> > If you need to say conclusively that something like 1001011001 is binary, it's much harder. That particular number is perfectly valid for any base Strictly speaking that number is not valid in base 1 [which is a valid base](http://en.wikipedia.org/wiki/Unary_numeral_system) which has a single arbitary digit (normally 1 is … | |
Re: You must declare a function before you call it, at lines 16/19 you respectively call ftoc/ctoc but this is the first time the compiler has seen those functions (it reads the file line by line). All you need to do is arround line 3 add the code lines static float … | |
Re: It is hard to know precisely what is wrong because you give no context but here are a few possibilities (with reference to the line numbers in the code you posted). 1. Line 235 you create a variable of RomanType, you try to return this from operator+ but the defined … | |
Re: Not quite sure where `sizeInTChars` comes from but it would appear that it's value is 0 when is should be at least 1 or 2. This looks like parameter checking of a function so I'm guessing `sizeInTChars` might be a function parameter in which case somewhere you have called the … | |
Re: Are you sure you solved the issue? Try this input data hello worlds a b c d NOTE The added s on worlds Does that work with your new code. The problem is that your comparison at line 39 is effected by the assignments at lines 43 and 56 which … | |
Re: It wont do either it will cause undefined behaviour. You must call free on the actually pointer value returned by malloc. If for some reason you need to increment the pointer you should use a copy so you can still free the original pointer. int main () { int * … | |
Re: That rather depends on the size of int on your computer. If size of int is 2 and size of long is 4 then in your struct ss there is likely to be 2 padding bytes in the structure between c and d. These bytes are never assign but it … | |
Re: > Because since i Have mentioned the brace for && operator to make it execute first The parentheses () do not make the contained code execute first. That is a simplistic way to think of them and wrong. The parentheses create a sub-expression with-in a complete expression. The sub-expression is … | |
Re: Pointers are passed by value. What this means is that for POD types passing a value to a function by pointer instead of by value makes very little difference. Imagine a 32 bit machine with 32 bit ints and 32 bit pointers. You have an integer to pass so in … | |
Re: It is very important to comment why some code does a particular thing, you can normally tell what it does just from reading the code itself. If you happen to have implement some specific algorithm then I would also comment what algorithm and may be why it was chosen. If … |
The End.