- Strength to Increase Rep
- +9
- Strength to Decrease Rep
- -2
- Upvotes Received
- 43
- Posts with Upvotes
- 38
- Upvoting Members
- 26
- Downvotes Received
- 9
- Posts with Downvotes
- 9
- Downvoting Members
- 8
- Interests
- Dream to fly light weight plane someday. Love adventure, video games.
238 Posted Topics
Re: 1> 28 posts and still no code tag 2> Try to practice [B]int main(){}[/B] not just [B]main() or void main()[/B] 3> Post the exact error that u are getting. The code seems to be ok I think. | |
Re: In line# 41 push(root); Are you trying to push root. You should have done: push(temp); In line#50 void free(void *ptr); What you are trying to do here. Are you trying to free the memory or you want to redefine the function free() ? Better read about free(). Also, review your … | |
Re: use while(1) loop and inside the loop read one character at a time. Break from the loop on getting something other that 0-9. Handle the space explicitly. If the numbers are multi-digit numbers you will have to use temp buffer to store the number till u get a space. | |
Re: 1- Most importantly, what u are doing here is not proper quick sort. Read about it. 2- I don't understand why you have sent the array as "*v[]". Why do you think u need that. Why not just "v[]". 3- Putting function prototype inside another function. Not a great way … | |
Re: line#14: You have never done a "new Dll11Node()" for "iterhere->_fore" and trying to access "iterhere->_fore->_back". This is an obvious segfault. Use [B]gdb[/B] to debug your code if you are working on Unix/Linux. Its not that tough to catch a segfault. | |
Re: Use CODE tag and PROPER indentation. Explain exactly what problem you are facing. | |
Re: one way is: [CODE] const char* foo = "\n1\n2\n3\n4" [/CODE] another is [CODE] char* foo[] = {"1", "2", "3"} int count = 3; for(i=0;i<3;i++) printf("\n%s", foo[i]); [/CODE] | |
Re: you can use [CODE]scanf("%[^\n]",...);[/CODE] as well to scan a whole line. | |
Re: [CODE] #include<iostream> using namespace std; int main() { int *matrix; int dimension; /*read dimension first and initialise "dimension" and then allocate apropriate memory to "matrix" and then read the matrix into this array. This can also be done inside a function which will make your code more usable*/ /*process the … | |
Re: First you must know how to retrieve the pixel data of the image. (Please google about that, I never tried it in C/C++, but its easy to get the same in Java which I have done) Then you have to know how to rotate an image(pixel-wise) [URL="http://homepages.inf.ed.ac.uk/rbf/HIPR2/rotate.htm"]http://homepages.inf.ed.ac.uk/rbf/HIPR2/rotate.htm[/URL] And then you … | |
Re: add [CODE]#include"savingsAccount.h"[/CODE] in the file "customer.h" | |
Re: read the information using scanf/cin and then create the command using them. | |
Re: [CODE]typedef ListNode *ListNodePtr;[/CODE] means you are making an alias for "ListNode*" as "ListNodePtr". So when you declare avariable of type "ListNodePtr" it will mean you are declaring a variable of type "ListNode*". [CODE]ListNodePtr *sPtr; ListNodePtr startPtr;[/CODE] You will get the difference once you replace the alias name with the original … | |
Re: you are not resetting the stringbuffer to ""(empty string) after every iterations which is the reason why it is keeping the previous values. Reset the stringbuf at the end of every iterations then only you will get the expected outputs. | |
Re: line# 15: This is not the way you invoke a function. You should first know how to do that. Please read more about functions. Some more feedbacks: line# 22 and 26: How do you handle the loop if the number of rectangle is variable. Better have another argument in the … | |
Re: [QUOTE=benjybob;1508912] 1>c:\users\ben\documents\university work\year 2\c++\code\myc++\spritelab\asteroidsgame.cpp(17): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\users\ben\documents\university work\year 2\c++\code\myc++\spritelab\asteroidsgame.cpp(17): error C2365: 'srand' : redefinition; previous definition was 'function' 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdlib.h(511) : see declaration of 'srand' [/QUOTE] Error #1: This is coming because C++ … | |
Re: Its in C itself. It is compiled and object is created which is archived in library. | |
Re: [CODE]mylinkedlist list_arr[20];[/CODE] where "mylinkedlist" is the linked list class. | |
| |
Re: [URL="http://www.google.co.in/search?hl=en&client=firefox-a&hs=6Ip&rls=org.mozilla:en-US:official&&sa=X&ei=3GF_TaIEjsq0BsCLhfkG&ved=0CG4QvwUoAQ&q=learn+guitar+strumming+patterns&spell=1#hl=en&pq=graphics.h%20in%20turbo%20c&xhr=t&q=graphics%20in%20C&cp=11&pf=p&sclient=psy&client=firefox-a&rls=org.mozilla:en-US%3Aofficial&aq=0&aqi=&aql=&oq=graphics+in&pbx=1&fp=116bc879be8b8161"]Google "graphics in C"[/URL] | |
Re: If you are talking about evaluating an expression, here is the link [URL="http://scriptasylum.com/tutorials/infix_postfix/algorithms/postfix-evaluation/index.htm"]http://scriptasylum.com/tutorials/infix_postfix/algorithms/postfix-evaluation/index.htm[/URL] | |
Re: Adding to that....... You can overload the operators ==, < and > for the class. | |
Re: In the recvfrom() function, use "MSG_DONTWAIT" flag in the 4th argument(which is the flag) and see whether it solves your problem. By default, the method will wait until it gets a message from the mentioned address, and your program will proceed only after that. Read the manual for recvfrom() [URL="http://man-wiki.net/index.php/2:recvfrom"]http://man-wiki.net/index.php/2:recvfrom[/URL] … | |
Re: Why on earth do you need a second array for reversing an array...!!! Below is a better approach to do it: [CODE] int i,j; for(i=0, j=arr_len-1;i<j;i++, j--)/*arr_len is the len of array*/ { /* swap arr[i], arr[j] */ } [/CODE] | |
Re: Please use CODE tags. Explain your problem clearly. Your class should be defined properly, e.g. [CODE] class spiral_matrix{ int N; int matrix_data[][]; public sparse_matrix(){ /*Constructor*/ } public init_matrix(){ /*initialize your matrix here*/ } public static void main(String argv[]){ /*...........*/ } /* other member methods*/ } [/CODE] | |
Re: IMP: Use Code tags. StringTokenizer [URL="http://www.java-samples.com/showtutorial.php?tutorialid=236"]http://www.java-samples.com/showtutorial.php?tutorialid=236[/URL] In the below code segment [CODE] if (p > 9) System.out.print(" " + p); else System.out.print(" " + p); [/CODE] What is that you are trying to achieve. (What are you doing different for the else part) | |
Re: any data type that you can think of. User defined types, char, unsigned, etc., anything..... | |
Re: [QUOTE=shinsengumi;1492086]Hi everyone! Is there a way/command in C to find a string that is contained in a longer string? [/QUOTE] strstr() is the answer to this problem of yours. [QUOTE=shinsengumi;1492086] I'm currently developing a C program in Windows that sends requests to a machine and gets its response through socket … | |
Re: before solving your problem lets look at the following code snippet [CODE] int x=4; int y=8; float z=x/y; cout<<z; [/CODE] Can you try this code and see what output you get. You might be expecting the output to be: 0.5 right ? But have a second look at the code. … | |
Re: example: file1.h [CODE] #ifndef FILE1_H #define FILE1_H int fun(); #endif [/CODE] file1.c [CODE] #inlclude"file1.h" int fun() { printf("in fnuction"); } [/CODE] file2.c [CODE] #include"file1.h" int main() { fun(); return 0; } [/CODE] If you are using some IDE, you can directly build the project because it will do the linking … | |
Re: [CODE] merge_sort((byte*)&people->name,count,sizeof(struct info),charcomp); [/CODE] This is not correct. Check what are the parameters you are sending. The prototype of the function should have been something like [CODE] void merge_sort( struct info data[], int n, int (*p_cmp_f)( ) ) ; [/CODE] And you should add another comparison function for comparing string. | |
Re: It wont' work if you try to send the address of the head node or any other node. The best way is to send the list data one by one through the pipe. You can use some flag values to mark when you are done with sending the values. If … | |
Re: I dont know what u r asking but a liked your algo for finding prime factors. Explain your query in a little more detail. | |
Re: u have to draw the left side line and right side line in the same loop by printing col number of spaces in between | |
Re: u can store the counter value at the end of the log file. Next time its opened, goto the end and read that value, increament it, and write to the file after writting everything else in it. Let me explain: Lets start with an empty logfile. Since it doesnot exists, … | |
Re: u first try the conversion of one form to another first. After u have tested all of them in individual programs u can try to integrate them............ | |
Hi Can anyone help me in suggesting how to prevent "out of memory" exception in java. I am getting this exception when I load a very large data in my application and after running the application for sometime the application throws this exception. I want to know if there is … | |
Re: Neither did you initialised i nor did you checked for the end condition. In your case since i is not initialised which have some garbage value and you are trying to access dictionary[i], which obviously will give u a segfault. Also, since you didn't put an end condition, the loop … | |
Re: read on string handling. U are declaring a char to store a string. U are using [CODE] if(acc_name=x){} [/CODE] whereas your intention is to compare string. The above statement is an assignment and the value will be true if the assignment was successful. Read how to read and compare strings. | |
Re: line 18: use the commented statement at line #15. remove the semicolon at its end. line #21: u are returning 0 on success. (0 is generally used as false) | |
Re: initialize as [CODE] union test u; u.f = 100.23; [/CODE] | |
Re: in main(), do as following: [CODE] int choice = menu();/*implement menu. It should returns the user choice*/ switch(choice) { case 1: fun1();/*your fun*/ break; case 2: fun2();/*your fun*/ break; /*some more cases as required*/ default: /*some error message*/ } [/CODE] | |
Re: then invoke the read() method before the loop to read the 1st 16 byte. If u dont want to read the remaining till the end remove the while loop. But I suppose U want to read the remaining also, then just keep them or make necessary change as u like … | |
Re: when u write [CODE] vector<int> pq; vector<int> data; [/CODE] the constructor gets invoke which is [CODE] vector<int>::vector(); [/CODE] In line #41, #42, #47, #48: what do u suppose u are doing. Thats not the way how u invoke the constructor/destructor. U could have done something like: [CODE] #ifndef MY_MIN_PQ_H #define … | |
Re: line #64: u are passing int * instead of int. do as [CODE] PrintOutput(*c, *d); [/CODE] | |
Re: when do u suppose the control is coming to line #25? | |
Re: when u create a new thread it usually cannot access the memory allotted to other process including its parent. U need to use shared memory or other IPC for communication. I may not be correct totally but this is an IPC issue. Read on how to communicate between diferent processes. | |
Re: [code] void Test::getNames(string[] names) { names[0] = "test1"; names[1] = "test2" return; } [/code] | |
Re: u will get the result by that approach also. But I would suggest u to compare the characters at the first half withe second character by character. | |
Re: line #11: u are calling fun1 and expecting the ret val of fun3 line #19: u are calling fun1 and expecting the ret val of fun2 |
The End.