238 Posted Topics

Member Avatar for sree2
Member Avatar for lotrsimp12345

line #224: U are getting the max node in the temp variable. But u have not put it in the particular location. No links assigned. !!!!!!!!! * Instead of deleting the cur node, copy the maxnode data into cur node and delete the max node. There may somemore error I …

Member Avatar for lotrsimp12345
0
85
Member Avatar for fedya

1> read an item 2> start from the begining of your list: if(new item > curent node item) move to next node else break 3> create a new node with the new data 4> put the new node in the current location.: *** for this u have to keep the …

Member Avatar for dkalita
0
89
Member Avatar for DeadJustice

in class AVLTree: You are not initializing root. Add a constructor and initialize the root with NULL in there. [CODE] AVLTree() { root = NULL; } [/CODE]

Member Avatar for DeadJustice
0
201
Member Avatar for zendet

that is not a way how u should proceed declaring so many variables with similar meaning. This is where people uses array. Use a 2D float array to store your scores. Use another array for storing the averages. e.g. [CODE] float judge_score[5][5]; float judge_avg[5]; [/CODE]

Member Avatar for dkalita
0
81
Member Avatar for reza.adinata

add the default constuctor in Carbol class. Check the line: [CODE] Carbol2 ubjuct; [/CODE] when u do this it invokes the default constructor of Carbol2 which is [B]Carbol2::Carbol2()[/B] and also the default constructor to the base class is invoked which does not exist. You have to write the default constructor …

Member Avatar for programmersbook
0
121
Member Avatar for teddy78

U are making a shallow copy for Message while assigning it to the data. U need to do a deep copy instead to retain the member data. Overload the assignment operator for Message class and use strcpy() in it for copying each of the member. There may be some more …

Member Avatar for teddy78
0
460
Member Avatar for Iam3R

include [B]stdbool.h[/B] The type is "bool" e.g. [CODE] #include<stdbool.h> bool b= true; [/CODE] this works in my compiler(cc).

Member Avatar for Iam3R
0
2K
Member Avatar for Iam3R

its because in line #7 u are reading using scanf() and its looking for an int as input. When u enter a non-digit character it doesn't get what it is expecting hence it won't set the value to the variable num. Try giving a character in the very first time …

Member Avatar for kvprajapati
0
82
Member Avatar for ms_farenheit1
Member Avatar for Fajer91
0
110
Member Avatar for aman rathi

[B]tower of hanoi [/B]is a very good example for solving by recusrion. Though recusrion is helpful at times while solving some very critical problems though it has some demerits. Read about recursion in more detail to know its merit and demerits.

Member Avatar for Cmad
0
119
Member Avatar for AdRock

when accesing at an index say kind.at(n) just make sure that n>=0 and n<kind.size() e.g. check in lines 85, 87, 88, 91, 118. I didn't checked it completely, do it yourself.

Member Avatar for dkalita
0
92
Member Avatar for rt.arti

everywhere u are accesing the members of some structure using pointer and there doesn't seem to be any check for NULL statemnt.

Member Avatar for dkalita
2
115
Member Avatar for maverick405

1> use code tag 2> in function square_array() and cube_array() u are modifying the original array loosing the original values.

Member Avatar for mrnutty
0
141
Member Avatar for dipisahu

[code] int main() { int two_d[10][20]; return 0; } [/code] take it.... or else tell us what problem u are facing with 2d array.....

Member Avatar for dkalita
0
68
Member Avatar for leeba

> line #4:Start using int main() instead of void main(). > line #25: when u reach the end, say i=3 and length of string is 4, u are accessing the (i+1)th element that is arr[4] which does not exist because your string ends at index 3. Try to correct it. …

Member Avatar for kommuru
2
67
Member Avatar for William Byrd II

u must intialize a static member. Add the line [CODE] int Counter::count = 0; [/CODE] before main() or other module where u are using or just after declaring your class. A static data member must always be initialized before being used.

Member Avatar for dkalita
0
134
Member Avatar for leeba

line #38: u are not using strtok() in the way u should. If u want to continue to get the next token then u must pass NULL in the 1st argument to strtok() after making the first call to it with the actual string. its like: [CODE] char *tok = …

Member Avatar for leeba
1
91
Member Avatar for jiten_raulo

that is called the arrow operator which is used to access the members of a class or a struct using a pointer. Check the link [url]http://iqsoft.co.in/cpa/notes-cpp/structs/arrow.html[/url]

Member Avatar for dkalita
0
81
Member Avatar for Justea

I still doubt your logic for solving a sudoku. Anyways what the checkDigit() method doing? And will u explain your logic in summary (not in codes just the summary such a pseudocode with minimum complexity).

Member Avatar for dkalita
0
74
Member Avatar for matrix0978

the loop for bubble sort is [CODE] void bubleSort(int data[], int size) { for(i=0; i<size-1; i++) { for(j=0; j<size-i-1; j++) { if(data[j] < data[j+1]) swap(&data[j], &data[j+1]); /*assuming swap function is there*/ } } } [/CODE]

Member Avatar for matrix0978
0
243
Member Avatar for yasaswyg

why have u written the code from line #22 to line #26. Do u think u need them.....?

Member Avatar for dkalita
0
203
Member Avatar for angermanaged

u need a heapsort.cpp file for creating heapsort.o U are not giving input to the g++ command in line #13 in the Makefile. If u have only a heapsort.h file where the whole thing is defined and u have included this file from driver.cpp then u can simply remove the …

Member Avatar for dkalita
0
120
Member Avatar for ayan2587

the function fun() takes a funtion(whose return type is int and with no params) pointer as its argument. And u are sending [B]main[/B] to that funcion. Thats it. Read on pointer to function.

Member Avatar for ayan2587
0
125
Member Avatar for Ashishinani1756

check links: [url]http://www.linuxforums.org/forum/linux-programming-scripting/26306-reading-directory-contents-files-c.html[/url] [url]http://www.linuxquestions.org/questions/programming-9/c-list-files-in-directory-379323/[/url]

Member Avatar for skp888
0
140
Member Avatar for Wong23

ofcourse it wil crash because it is getting into an infinite loop because its not reaching the final condition. make your condition from [B]if(n==0)[/B] to [B]if(n<1)[/B] in the factorial function

Member Avatar for dkalita
0
104
Member Avatar for seo2005

[QUOTE=seo2005;1033857] Suppose I enter 321 y will become 32 z will become 1 x will be 32 It will print first z which is 1 then it will print x which is 32 But it should have been 123 ( Reverse of 321) [/QUOTE] why wil it print 32. See …

Member Avatar for pramodsajwan07
0
116
Member Avatar for NinjaLink
Member Avatar for basitkhan
-1
2K
Member Avatar for Kuroshi

yes you can try something like this [code] bool isAWin(char &winner) { if(isWin('O')) /*considering your players as X and O (change to whatever u are using)*/ { winner = 'O'; return true; } if(isWin('X')) { winner = 'X'; return true; } winner = ' '; return false; } bool isWin(char …

Member Avatar for Kuroshi
0
147
Member Avatar for EastJohn
Member Avatar for s.p.i.

what is the reason that made u feel that the statements [CODE] for(n=i+1;n<size1;n++) [/CODE] and [CODE] for(n=1;n<size1;n++) [/CODE] are equivalent. How does 1 and i+1 becomes same. That is the logic and u are changing the whole logic for sorting.

Member Avatar for dkalita
0
96
Member Avatar for Iam3R
Member Avatar for godsgift2dagame

line #57 and #59. using = instead of == fom comparing also couldn't get these lines [CODE] if(balls[i] = 10) //use == { if(balls[i] = 10) //use == /////////////////////////// [/CODE] why the second condition when u already did it......

Member Avatar for dkalita
0
83
Member Avatar for Carrots

may be u can display using cout as [CODE] string str; char *buf = (char *)&str; /*u need to know the size of 'str'*/ /*sizeof(str) might work but m not sure about it*/ int i; for(i=0;i<sizeof(str);i++)/*considering sizeof() works*/ cout<<(unsigned short)*(buf+i)<<","; [/CODE] I dont know any feature in KDev for displaying …

Member Avatar for dkalita
0
195
Member Avatar for Grim279

The error message is clear enough. U are defining the function [B]void PlaceYourBet()[/B] more than once. Check your code.

Member Avatar for Grim279
0
98
Member Avatar for miskeen

[QUOTE=miskeen;1035838]But, is there any proposed solution to what I'm looking for?[/QUOTE] use if() statement and strcmp() function for your purpose.

Member Avatar for miskeen
0
130
Member Avatar for Iam3R

1> finding the mid: Your function for finding the mid element is good enough. The complexity is O(n/2) not O(n) but anyway O(n/2) is also considered O(n) only when n is very large. 2> mid of even set of data Its upto you or upto the requirement which will tell …

Member Avatar for Iam3R
0
130
Member Avatar for chornox

I dont think u can do that. Its because the console is just a resource and the same resource cannot be shared by more than one process at a time. When u are doing a read operation the console is reserved for that process and any write operation will only …

Member Avatar for dkalita
0
96
Member Avatar for jeeter19

May be u can get some hint from this thread. [url]http://www.daniweb.com/forums/thread33551.html[/url] Many of the machine info u can get from the files present in the following folder: [B]/proc/sys/kernel[/B]

Member Avatar for dkalita
0
193
Member Avatar for punchinello

Ofcourse there are generic ways to make a recursive method non-recursive. Just google for it. U wil get that. Regarding the use of recursive functions: It is not recommended always because it may lead to stack-overflow and crash of your program if the iterations are large in numbers. But its …

Member Avatar for punchinello
0
84
Member Avatar for tomtetlaw

the param to a switch cannot be a string. It can only be an integer. To achieve what u are trying use if-else statement alongwith strcmp().

Member Avatar for slackingjuggalo
0
716
Member Avatar for gandolf III

Thank god there are only 26 alphabets. If there were 100 u would need to write 100 if statements. May be u can take some other approach for your problem such as: write a function like [CODE] void removeDuplicate(char *str); [/CODE] It doesn't necessary that a user wil input a-z. …

Member Avatar for dkalita
0
112
Member Avatar for ured
Member Avatar for samsons17

its says the character 'a'. Like we represent a string using double quote, e.g. "test string", we represent a character using single quote, e.g. 'a'.

Member Avatar for mrnutty
0
80
Member Avatar for neithan

[CODE] for(unsigned i = 0; i < cantidad_frases; i++) { for(; *frases[i]; frases[i]++) { *frases[i] = getchar(); } } [/CODE] U have not assigned memory to frases[i]. Do [CODE] #define MAX_STR 40 // whatever u want frases[i] = malloc(MAX_STR); [/CODE] U are alos doing another mistake: [CODE] for(; *frases[i]; frases[i]++) …

Member Avatar for neithan
0
162
Member Avatar for necrolin

[CODE] void f(int** a) //its a pointer to a pointer. The argument to the function f is a pointer to pointer { cout << **a; //prints the value stored in a, output is 45 cout << *a; //address of the memory where 45 is stored cout << &a; //address of …

Member Avatar for dkalita
0
90
Member Avatar for BestJewSinceJC

Hi, I compiled that file (client) and I am not getting any error . !!!!!! I used cc compiler and compiled on the following OS [CODE] Linux mymachine 2.4.20-28.9.XFS1.3.1smp #1 SMP Mon Jan 5 13:20:15 CST 2004 i686 athlon i386 GNU/Linux [/CODE]

Member Avatar for BestJewSinceJC
0
188
Member Avatar for GPXtC02

u are doing it in the correct direction. Go ahead with your code and test it. May be (not sure) u need to break up your file into smaller blocks for transferring if the file is very large.

Member Avatar for dkalita
0
118
Member Avatar for Gribouillis

[QUOTE=Gribouillis;1030204] The function main in myprog will receive a char** argv containing the following strings [code] "-z", "hello", "-m", "this is a message" [/code] [/QUOTE] One small correction. char** argv will contain [code] "myprog", "-z", "hello", "-m", "this is a message" [/code] [QUOTE=Gribouillis;1030204] So there must be somewhere in a …

Member Avatar for Gribouillis
0
218
Member Avatar for Bips123

[QUOTE=Bips123;1030240]Hi, I hav heard that it isn't that simple to write a program in linux using c. Lots of commands n stuff.Please simplify what actually I've got to do to run turbo c++ in my linux laptop as I am a beginner.[/QUOTE] I guess U will change your opinion once …

Member Avatar for Ancient Dragon
0
140

The End.