556 Posted Topics

Member Avatar for ilovephil

You can only store a single character because in your node structure [code] struct node { char nbook; struct node *next; }; [/code] You only provide space to store a single character. You need an array of characters if you want to store a whole string.

Member Avatar for Banfa
0
136
Member Avatar for jumo1807

You would perhaps do better to specifically catch the values 2 and 3 and return TRUE before the line in green. The line in green could then check if the number is divisible by 2 and return FALSE if it is. Numbers divisible by 3 are caught by your loop …

Member Avatar for Lerner
0
135
Member Avatar for pendo826

You are not altering the size in remove. Resize still refers to m_size At line 95 you have [icode]index—[/icode] but I think you mean [icode]index--[/icode] NOTE that is not a minus in what is currently in your source file.

Member Avatar for raptr_dflo
0
188
Member Avatar for pushpat

dptr and bptr_1 both point to the same allocated objected. You should only delete an object once, as soon as you delete it the pointer becaomes invalid and any access to that pointer, either dereferencing it or trying to delete it again is undefined behavior. You allocate the object pointed …

Member Avatar for pushpat
0
145
Member Avatar for pendo826

Your problem is in your array class, you have declared half you data members at the top of the class (line 9) and then some more half way down (line 42) and as a result you have 2 size members which you use interchangeably but you only initialize one of …

Member Avatar for pendo826
0
470
Member Avatar for swissknife007

It rather depends on what else is implement and how you have implemented your division. For example if you have implemented the division as while number is greater than divisor subtract divisor from number then whatever is left when you finish is the remainder. If you want a specific operator …

Member Avatar for Banfa
0
147
Member Avatar for Newbienoob

Compare line 33 and 36, you call printukas with no parameters but it expects 1. This is why you should provide prototypes for your functions before calling them. I expect you were getting and ignoring compiler warnings. Don't ignore compiler warnings they have been printed for a reason work out …

Member Avatar for Banfa
0
145
Member Avatar for sajaddehghan

In this case these line are declaring variables the * means pointer to so in int* a; This is read as a is a pointer to an int, that is a contains the memory location of an int variable. int** b; There are 2 * you read the pointer to …

Member Avatar for JasonHippy
0
154
Member Avatar for arunsolo1984

When you say it fails I assume you mean gives the wrong result? This line of code is the issue partial = a->word0 + b->word0; word0 in your structure is 16 bits and you are on a 16 bit platform/compiler so this will perform the calculation in 16 bits and …

Member Avatar for Banfa
0
187
Member Avatar for newbie1234

That is correct but I believe you have misunderstood what the || operator does. || is the logical or operator, it's output is true or false, or in integer terms 1 or 0. The inputs are treated as logical inputs which means in C++ 0 = false anything else is …

Member Avatar for Banfa
0
96
Member Avatar for tom12

You for loop condition is wrong [icode]i<=-lenght[/icode] the - sign means that for a string with at least 1 character the loop never runs because 0 is greater than all negative numbers. Also remember that C++ indexes start at 0 so if an array has 4 entries its valid indexes …

Member Avatar for Banfa
0
120
Member Avatar for broodwich

You are missing an opening brace in your declaration of accounts [code] int accounts[SIZE] = [b]{[/b] 5658845, 4520125, 7895122, 8777541, 8451277, 1302850, 8080152, 4562555, 5552012, 5050552, 7825877, 1250255, 1005231, 6545231, 3852085, 7576651, 7881200, 4581002 }; [/code]

Member Avatar for Banfa
0
196
Member Avatar for pieftw

The problem is the way you have written your outer for loop, even though you don't increment i when out output a factor the loop always increments i so you never test the same factor twice. However if you remove the i++ from the loop you will have another problem, …

Member Avatar for Banfa
0
168
Member Avatar for tpoole00

The problem is that you only have 1 buffer [icode]word[/icode] so as soon as you encrypt the string it contains you no longer have access to the original data. What you need to do is have 2 buffers and then copy the input data to the second one and do …

Member Avatar for Banfa
0
127
Member Avatar for triumphost

That just ain't how you do it, you need to implement (overload) ArrayOfTypes::operator[] and MyType::operator= separately to achieve what you want not try and do it together which is presumably this [code] ArrayOfTypes array; MyType value; array[10] = value; [/code] ArrayOfTypes::operator[] returns a reference to a location in the array …

Member Avatar for Banfa
0
261
Member Avatar for livinFuture

You could implement this fairly easily with a std::map rather than writing all your own code. However clearly in your valueAt method you need to be iterating over the entire array not just performing a single if test. Your MatrixType must surely store a std::vector (or array) of oneitem and …

Member Avatar for livinFuture
0
203
Member Avatar for Keeame

You really should have posted the errors at each step, then you could have tried to help with the original problem rather than the problems with the non-working solutions to the original problem. For starters [icode]"www.facebook.com".c_str()[/icode] the problem here is that "www.facebook.com" is not a string object so you can …

Member Avatar for Banfa
0
174
Member Avatar for newbie1234
Member Avatar for Software guy
0
2K
Member Avatar for Ketsuekiame

You need to explain more fully. It sounds like this is really a C question, you appear to be calling a C API even if your program is written in C++. Are you saying that you are trying to write you own method called shutdown but you still want to …

Member Avatar for Ketsuekiame
0
169
Member Avatar for MrAppleseed

The function pointer in the structure is a data member of the structure just like any other data member and can be initialized like so [code] struct foo bar = { func }; [/code] But you are always either going to have to explicitly initialize it or assign it.

Member Avatar for L7Sqr
0
112
Member Avatar for Kanoisa

The real answer is that the overhead of calling a virtual function is so low that it is unlikely to cause you a problem in the majority of cases. This is definitely a case of trying to solve a problem before you know it exists. In all likely hood your …

Member Avatar for Kanoisa
0
196
Member Avatar for Guipborges
Member Avatar for b56r1

getchar returns int not char. You need to store the value as an int to test against EOF because EOF is defined as an int (normally with the value of -1). If you converted the value of getchar to a char before comparing to EOF you would have trouble in …

Member Avatar for b56r1
0
119
Member Avatar for TrancededTora
Member Avatar for Banfa
0
43
Member Avatar for baldwindc

You can use Visual Studio its OK. But if you are using Linux and Windows you may want to try something like Code:Blocks or Eclipse which are multi-platform and run on both Linux and Windows, that way you only have to learn the ins and outs of 1 IDE that …

Member Avatar for baldwindc
0
242
Member Avatar for slygoth

It would help if you posted your code in CODE tags. As well has having functions called smallest and largest you also have variables (int) called smallest and largest.

Member Avatar for slygoth
0
153
Member Avatar for lisaroy1

The only place I have come across far pointers in far pointers is as an extension in WIN16 C compilers. 16 bit Windows (WIN16, Windows 3.11 and earlier) had 16 bit addressing, which allowed you to access all of your 64kbyte memory segment, the pointer was the offset in the …

Member Avatar for Banfa
0
230
Member Avatar for ben25x

It would help if you posted the entire error message because following the text "unresolved external" is usually the name of the symbol it is unable to find.

Member Avatar for Banfa
0
245
Member Avatar for JDevelop

[icode]char* temp = (char*) malloc(sizeof(*string1));[/icode] Consider string1, what type is it? char * from the function prototype. In that case what type is *string1? If string1 is char * then dereferencing it gives char. What does sizeof(char) return? 1 (by definition in the C standard) I do not believe you …

Member Avatar for JDevelop
0
285
Member Avatar for illuminatus89

You can't initialise anything that has already been declared. You can only initialise something at the time it is created, after that it becomes assignment. And to answer the spirit of your question no there is no way to assign to all members of an existing array without recourse to …

Member Avatar for benwilliams
0
248
Member Avatar for Madmark88

Perfect numbers are few and far between the next perfect number after 8128 is 33550336 which is rather greater than 1000000 so your program can not find it. It would appear that your program may be working.

Member Avatar for Madmark88
0
100
Member Avatar for Adami

You are not taking account of escaped characters in strings, for example how would your code cope with the string [icode]"\"//"[/icode]. You are not taking account of character constants, how would you software cope with [icode]'"'[/icode] This [icode]while ( (ch=fgetc(fd)) != (feof(fd)) )[/icode] is wrong and might well result in …

Member Avatar for Banfa
0
125
Member Avatar for TheDestroyer

That is not a part of the program itself as the program is not running until <Enter> has been pushed on a valid command line. It is a function of the shell (Bash) what I can not tell you is if it is built into the shell or if the …

Member Avatar for TheDestroyer
0
2K
Member Avatar for dip7

Start a command prompt and run you program in it. Dev-C++ is a bit long in the tooth you may want to try something a little more up-to-date like CodeBlocks.

Member Avatar for Ancient Dragon
0
95
Member Avatar for MichaelSammels

An array of structures with what members? If you do not know the format of the binary file about the best you can do is read it into an array of char.

Member Avatar for Adak
0
174
Member Avatar for bleedi

The error probably appears random because you are calling gai_strerror when you should be calling strerror.

Member Avatar for bleedi
0
145
Member Avatar for efronefron

At line 100 this [icode]letters[ ((i % 100)/10)* 10 ] + letters[ i%10 ][/icode] can be replaced with [icode]letters[ i % 100 ] [/icode] Think about say 345, this is working out the number of letters in 45, you method adds the number of letter in 40 (forty) and 5 …

Member Avatar for efronefron
0
602
Member Avatar for deanus

Of course like this [code] #define ROOT "C:\\SomeRoot\\" #define SUB_DIR ROOT "SubDir\\" [/code] A rarely use feature of C++ (and C) is the the compiler automatically contatinates contiguous strings. A better question is should you given this is C++ or should you just use constant objects [code] const std::string root …

Member Avatar for Banfa
0
207
Member Avatar for imolorhe

I would say you have 2 options (remembering that the majority of processes, even multi-threaded ones do not actually run concurrently, mostly they time-slice, that is each thread gets a chance to run in turn and while a thread is running non- of the other threads of the process are …

Member Avatar for mike_2000_17
0
196
Member Avatar for florisvd

Your code doesn't try to send anything. Most UARTs also produce an interrupt, normally on data received, on error and possibly on ready to send data. It is common (and therefore I assume I good approach) to handle data receive using the UARTs interrupt and it is often a requirement …

Member Avatar for Banfa
0
101
Member Avatar for vineeshvs

You have some many blank lines it makes your code much longer than required and so less readable. You have redundant duplicate variables, for example M in dc4 is just a copy of nrows, however neither variable is ever changed so one of them is redundant. However I believe your …

Member Avatar for vineeshvs
0
111
Member Avatar for protas

The if statement (line 32 - 48) needs to be inside the else block (line 27 - 31) because that code should only be run if ab != 0. The return at line 24 then becomes redundant (it is not uncommon for coding standards to ban returns in the middle …

Member Avatar for prushik
0
5K
Member Avatar for Wej00

Global data is bad, however it is not always avoidable. There are no hard and fast rules in C++ just best practice and less good practice and you need to know when to ignore best practice. I would say make a big effort to avoid making any global variables that …

Member Avatar for Banfa
0
1K
Member Avatar for xagutxu

You do not have to wait to see if an event is set. You can test the event without waiting if you call something like WaitForSingleObject with the dwMilliseconds parameter set to 0 then the function will return immediately indicating if the event signalled or not at that time.

Member Avatar for Narue
0
248
Member Avatar for imolorhe

Or a set would work, a set of the actual values would returned not found if you looked up a non-existing value. On NULL it really only applies to pointers. It is a special representation for the platform that indicates that the pointer is invalid. The NULL pointer for a …

Member Avatar for mrnutty
0
532
Member Avatar for bleedi

Line 28 and 47 of the client you strcat into an allocated buffer that contains random data (malloc does not clear the contents of the memory it allocates). Make the first call in each of those sets strcpy.

Member Avatar for nezachem
0
209
Member Avatar for devkc

And what does that program do when the bot handle respectively 1.It has to follow white line track on the black background. 2.It should has high speed. 3. The path has intersection, curve turns, sharp turns (60 degree turn), discontinuities. Does it handle them correctly or does it do something …

Member Avatar for akshaydusane
0
148
Member Avatar for Cup of Squirrel

Talking of IDEs recently I have been using Geany, which is less of an IDE and more of an extended editor. However the reason I mention it is that (assuming you already have the compiler installed but I am using it on Linux so that is less of a problem …

Member Avatar for mslade
1
2K
Member Avatar for harunosakura

Do you mean you have strings of 1s and 0s that you need to add as if they were binary numbers? All actual integers are held in binary (on the whole) anyway so adding 2 binary digits is as simple as [code] int a = 2; // binary 10 int …

Member Avatar for Lerilaine
0
199
Member Avatar for spetsnaz26

Lin 6 fills me with some dread. What do you suppose [icode](end-begin)[/icode] does? When end and begin where pointers in your array/pointer implementation the answer was obvious but now end and begin are not pointers, they are objects and I am slightly surprised that that construction even compiles as I …

Member Avatar for shijobaby
0
341

The End.