556 Posted Topics

Member Avatar for SirDK

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.

Member Avatar for Banfa
0
304
Member Avatar for laleh.97
Re: pi

* 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 …

Member Avatar for rubberman
0
228
Member Avatar for Banfa

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 …

Member Avatar for Banfa
0
154
Member Avatar for ragnacrap

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 …

Member Avatar for Banfa
0
333
Member Avatar for cambalinho

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.

Member Avatar for cambalinho
0
346
Member Avatar for cambalinho

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?

Member Avatar for cambalinho
0
466
Member Avatar for lightdshadows

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 …

Member Avatar for mike_2000_17
0
1K
Member Avatar for toneranger

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() : …

Member Avatar for toneranger
0
271
Member Avatar for refphlex

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.

Member Avatar for refphlex
0
167
Member Avatar for roidbeginnerlvl

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 …

Member Avatar for richieking
0
203
Member Avatar for andrew mendonca

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 …

Member Avatar for Banfa
0
215
Member Avatar for Saurav Akolia

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 …

Member Avatar for Moschops
0
138
Member Avatar for skyyadav

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 …

Member Avatar for Banfa
0
978
Member Avatar for andrew.mendonca.967

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 …

Member Avatar for tinstaafl
0
340
Member Avatar for younes.keraressi

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 …

Member Avatar for younes.keraressi
0
180
Member Avatar for Williams2222

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 …

Member Avatar for Ancient Dragon
0
830
Member Avatar for H_beginner

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

Member Avatar for Banfa
0
454
Member Avatar for abhimanipal

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 …

Member Avatar for abhimanipal
0
253
Member Avatar for parth2911
Member Avatar for cambalinho

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 …

Member Avatar for cambalinho
0
391
Member Avatar for kalo150

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.

Member Avatar for Schol-R-LEA
0
102
Member Avatar for Sci3nc3F1cti0n

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 …

Member Avatar for Sci3nc3F1cti0n
0
593
Member Avatar for GeekPlease

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 …

Member Avatar for GeekPlease
0
189
Member Avatar for Falcon143

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 %= …

Member Avatar for Banfa
0
2K
Member Avatar for pooja.singh.3950

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 …

Member Avatar for nchy13
0
246
Member Avatar for nitin1

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`;

Member Avatar for deceptikon
0
113
Member Avatar for sash_007

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

Member Avatar for sash_007
0
355
Member Avatar for J-P1988

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 …

Member Avatar for Banfa
0
502
Member Avatar for jandanielsaclolo

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.

Member Avatar for jandanielsaclolo
0
257
Member Avatar for nchy13

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 …

Member Avatar for mike_2000_17
0
194
Member Avatar for Banfa

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 …

Member Avatar for mike_2000_17
0
232
Member Avatar for Antriksh_1

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 …

Member Avatar for mike_2000_17
0
243
Member Avatar for pooh1234qwerty

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 …

Member Avatar for nullptr
0
141
Member Avatar for mahesh113

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 -, …

Member Avatar for rubberman
0
138
Member Avatar for nitin1

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 …

Member Avatar for Banfa
0
311
Member Avatar for general2012

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 …

Member Avatar for general2012
0
249
Member Avatar for nitin1

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 …

Member Avatar for Banfa
0
120
Member Avatar for wnr78ta

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 …

Member Avatar for Banfa
0
776
Member Avatar for bazingatheory

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 …

Member Avatar for Moschops
0
352
Member Avatar for sushants

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.

Member Avatar for Banfa
0
162
Member Avatar for kamalashraf

<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 …

Member Avatar for Banfa
0
543
Member Avatar for salesman91

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 …

Member Avatar for salesman91
0
273
Member Avatar for daniel1977

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 …

Member Avatar for daniel1977
0
296
Member Avatar for Suzie999

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 …

Member Avatar for Suzie999
0
378
Member Avatar for you207

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 …

Member Avatar for Banfa
0
226
Member Avatar for govindh2so4

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 * …

Member Avatar for Schol-R-LEA
0
659
Member Avatar for saurabh.mehta.33234

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 …

Member Avatar for saurabh.mehta.33234
-1
125
Member Avatar for saurabh.mehta.33234

> 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 …

Member Avatar for Banfa
-1
232
Member Avatar for tomz6

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 …

Member Avatar for Banfa
0
997
Member Avatar for azareth

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 …

Member Avatar for <M/>
0
246

The End.