161 Posted Topics
Re: Or maybe [CODE] arr1 = 3 0 0 5 size=4 arr2= 3 0 5 size=3 // array sol of size 5 here [/CODE] then we need the array solution as size 4+1. It will still be simulation of decimal addition, but in that case two loops might be required. One … | |
Re: [Quote] A year is a leap year, if it is divisible by 4. [/Quote] That is incorrect. Check this thread for determination of leap year [url]http://www.daniweb.com/forums/thread118753.html[/url] | |
Re: ^ I think so. Most people on this forum would not find this problem challenging. | |
Re: [quote]and must be able to handle unusual situations (e.g., what if two days have the same number of cars?)[/quote] For this you can do what Ancient Dragon said and find out the maximum/minimum value and then traverse the array once again and compare each element with the maximim/minimum value, if … | |
Re: I would suggest you use stepper motors [url=http://en.wikipedia.org/wiki/Stepper_motors"]Stepper motors[/url] for the controllers try pic [url="http://en.wikipedia.org/wiki/Pic_microcontroller"]pic microcontroller[/url] or AVR series from Atmel [url]http://en.wikipedia.org/wiki/Atmel_AVR[/url]. Coding for both is done in C and can be easily programmed ( I use AtMega 16 from Atmel). The softwares are variable depending on the microcontroller you … | |
When I try to view my profile by clicking on the link of my id on the top ( not the control panel). I am getting this error [quote] This user has not registered and therefore does not have a profile to view. [/quote] It was working fine a few … | |
Re: OSI model is representation of networking via seven layers namely. Physical layer, Data link layer, network layer, transport layer, session layer, presentation layer and finally application layer. More info [url="http://en.wikipedia.org/wiki/OSI_model"]here[/url] If you are interested in networking then it would be a good start to know about the various layers. | |
Re: A simple method for calculating square root of a number "a" is given by newton iteration as [CODE=C++] for(int i=0;i<10;i++) { xn=.5*(x0+(a/x0)); x0=xn; } [/CODE] where x0 is initialized to 1. Use float comparisons and loop till xn equals x0 here I have used a loop for simplicity. Again why … | |
Re: In the above loop you would have to check for every i if it is odd or not using [CODE] if(i%2!=0) [/CODE] alternatively you could use i=i-2 instead of i-- and simply display the numbers. | |
Re: I disagree with #3, free T shirts are great :D | |
Re: At line 7 when the loop ends, f will be 10. You are simply multiplying 1*10 and storing it in result. You can make result an array of size 10 then use [CODE=C++] result[f-1]=k*f; [/CODE] | |
Re: I dont know what you are trying to do but in line 12 during the last iteration of the loop i=4, i+1 will be 5 that will go out of bounds for the array pass. Run the loop till i<4 because there will be no i+1 for the last element. | |
![]() | Re: I have not read your problem in detail but a very interesting solution was provided here for generating unique random numbers [url]http://www.daniweb.com/forums/post345682-9.html[/url] ![]() |
Re: Addiction for anything is bad (at least that is what I think). I myself was addicted to computer games once. | |
Re: Half Life 2, Max Payne, Doom 3, AOE 2, FIFA 05. Best multiplayer games I have played are Quake 3 CPMA and Counter Strike 1.6 :D | |
Re: Try setting your ethernet ip to auto assign insted of using a static one. | |
Re: [QUOTE=Lardmeister;550298]Think about it! If you nuke Iraq, the fallout will go to downwind countries like India, China, Indonesia, Australia and so on.[/QUOTE] Also there will be internal pressure from people against it. I remember that many Americans opposed the war on Iraq. Nuking them will trigger an outrage. | |
Re: sumE, num and temp are local to main. Pass these variables by reference in order for the changes to show. | |
Re: If you want to do it by using regular expressions you would need a lexical analyzer. For C/C++ lex is usually used. Here is a tutorial page [url]http://dinosaur.compilertools.net/lex/index.html[/url] as for the code [CODE=C++] int i, char x; for(i = 0; i <= test_string.length; i++) //checks the entire length of the … | |
Re: Why create an array? A simple if can do the job unless I am missing something [CODE=c++] if (fabs(value-value_to_be_compared)<.001) { // match found } [/CODE] | |
Re: Factorial of any number greater than 5 ends with a zero. For a larger number, the number of zeroes at the end constitute a large part of the number. If you can eliminate those zeroes it will help. If you can simple check at the end of the factorial that … | |
Re: If you use gcc the header files are <sys/socket.h> <arpa/inet.h> | |
Re: [QUOTE=nurulshidanoni;558412]Is it true to make a condition statement?[B] &&[/B] [code=C++] int count; count++; for ( int i = 0 ; i < students.size (); i++ ) { for ( int k = 1;k<students.at(i).examcode.size(); k++ ) { if (students.at (i).examcode.at(0)==1 && students.at (i).examcode.at(k)==1) { count++; } } } cout<<"(1,1)="<<count; cout <<"\n"; … | |
Re: Power grid failed twice in the past 3 days resulting in power failure for 12hrs and 10 hrs respectively. And its 32 degrees celsius here in Delhi :( | |
Re: [QUOTE=dilip.mathews;230318]I dont want the maximum sum . I want the subset with maximum sum. {5,-2,10,-4} Here the subset with maximum sum is {[COLOR=blue]5,-2,10[/COLOR],-4}. The program should output {5,-2,10} I think u got my point.[/QUOTE] I dont understand, sum of the subset [5,10] is clearly greater than that of [5,-2,10] | |
Re: Maintain two counters and iterate the string one character a time. Use one if condition to check if the character is a vowel or a consonant and increment the respective counter. | |
Re: What I would suggest is that you make a function of everything starting from "int g;" to the end of the while loop. Then in main() call the function inside another loop as [CODE=c] do { function_here(); printf("Excellent!you guess the number\nWould you like to play again (y or n)?\n"); scanf("%c",&a); … | |
Re: People spitting on roads or throwing garbage out of their cars. | |
Re: Calculate different values of y by incrementing x by small steps. In the char array set the value char[x][y] to '*' For example y=0 if x=0 i.e char[0][0] = '*' y=1 if x=1 i.e char[1][1]='*' y=4 if x=2 i.e char[2][4]='*' and so on. Though it will go out of bounds … | |
Re: [CODE]array = new messages[size];[/CODE] array is of type int and you are trying to create an array of type messages. Change the datatpye of array to messages. [CODE]array[i].messages = value;[/CODE] I cant say what you are trying to do here, messages is the name of the structure. If you mistyped … | |
I just started with image processing concepts and cannot decide upon a platform to try examples on. The two most commonly used platforms are Matlab and C# (using Aforge libraries). I know a bit of both and learning the syntax will not be a problem. Which one should I go … | |
Re: In order to create a executable, you need Matlab Compiler. [url]http://www.mathworks.com/products/compiler/[/url] I think this might help in creating an exe from c++ [url]http://www.onecore.net/howtocreate-standalone-executable-for-matlab-file.htm[/url] | |
Re: Averaging will not help. Sorting and selecting the middle value will. | |
Re: You can set the fonts by using the settextstyle() function. Here is a link with an example [url]http://www.cs.colorado.edu/~main/cs1300/doc/bgi/settextstyle.html[/url] You can set background color using setbkcolor() [url]http://www.cs.colorado.edu/~main/cs1300/doc/bgi/setbkcolor.html[/url] To set the color of the text use setcolor() before settextstyle() [url]http://www.cs.colorado.edu/~main/cs1300/doc/bgi/setcolor.html[/url] | |
Re: I tried drinking beer once, from that day I have always wondered how can people like something that tastes that horrible. I will settle for Pepsi anyday. | |
Re: The functions are not properly defined. All functions sername(), sertel(), addrec(). Must have an argument of an array type. For example. addrec(char[], double[]) I dont think you have made this program yourself. | |
Re: In strcmp you are passing a pointer of node where you should pass a pointer of char. | |
Re: The things you mentioned are not difficult provided you know object oriented programming in C++. Do classes and inheritance well. | |
Re: Something on compression maybe. Try compression using Huffman coding. There is plenty of reference material on it on the internet. | |
Re: Okay I made this code on Turbo C [CODE] #include<iostream.h> int eig(int num) { if(num<10) { return num; } else { return eig(num/10)+(num%10); } } void main() { int n,ans=0; cin>>n; ans=eig(n); while(1) { if(ans<10) { break; } else { ans=eig(ans); } } cout<<"Eigen number is "<<ans<<endl; } [/CODE] Its … | |
Re: [QUOTE=atish00;547934]is the s.erase user defined fuction ?? coz I can't find it anywhere in c++ help.[/QUOTE] Which version of C++ are you using? It is not there in Turbo C++. | |
Re: Use else if statement. According to your code, if a=0 and b=0 then both the first and the second if statements will be executed. And the output will be "There are no solutions" "There is one solution x" use this [CODE] if (a == 0 && b ==0) { printf("There … | |
Re: Try a technique called circle extraction using Hough transform. It may be difficult to implement but a line extraction version is given in aforge examples. | |
Re: I am presently working on emulation of human movements through robotics as my college project. | |
Re: From what I remember of my coordinate geometry, testing for a point inside a triangle wasnt easy. Try this [url]http://mathworld.wolfram.com/TrianglePointPicking.html[/url] you might have to translate one point to match that of origion. | |
|
The End.