581 Posted Topics
Re: It is really hard for us to actually find the error without knowing what exactly your code is , Though You dont post the whole code, Post the Class And atleast 20 Lines Before and After the Class Definition, Other-wise you can attach the whole file (donot forget to include … | |
Re: Well , I believe that , Random Numbers arent really random at all, Even if you ask a human to tell a sequence of random numbers they are again dependant on the mentality of a human being i mean his likes or dislikes , Date of Importance to him, What … | |
Re: How about using NCURSES and then getch() ; Posted lately sorry, | |
Re: This is what organising is all about. First to get rid of the string error, Include string in the header file. Next, You can either put all your class declarations on the top of your header file or you can declare prototypes of the class in the top of the … | |
Re: Hello Gwen, Welcome to DANIWEB. Well though I see that your declaration of a struct is quite proper, There is a major fault in your code. First of , we start by considering what exactly a [icode]struct[/icode] is. When you use the struct specifier , its almost like you are … | |
Re: Welcome to Daniweb and Also to C++, Firstly Please Use CODE TAGS the next time you post in your question, Firstly I see that you are Using a outdated compiler. Though it is not il-legal to use it . It is considered better if you use a modern compiler like … | |
Re: [code] BOOL WINAPI ExitWindowsEx(UINT EWX_REBOOT, DWORD SHTDN_REASON_MAJOR_HARDWARE); [/code] This somehow looks like you are declaring a function . Though what you need is to call it. I am not a Windows expert but try this. [code] ExitWindowsEx(UINT EWX_REBOOT, DWORD SHTDN_REASON_MAJOR_HARDWARE); [/code] Also check if the function is embedded into a … | |
Re: Firsty, The Code for The Sieve is faulty.Actually its not a sieve at all. But anyways, Lets come back to the Segmentation fault, The reason for the segmentation fault is that your code [icode]j=i*i;[/icode] is actually causing j to cross the bounds of an integer at a high value of … | |
I am confused by the use of an un-named namespace and its practical applications. The C++ Programming Language states that. [code] namespace { //Content } [/code] [b][COLOR="Green"]is equal to [/COLOR][/b] [code] namespace $$$ { //Content } using namespace $$$; [/code] Where $$$ is a unknown and random name. However I … | |
Re: Hey, Arent you using the wrong formula, I mean the geometric sequence. [TEX] a/i-r[/TEX] is the value when a geometric progression goes to infinity. But we know that i ranges from 1 to 38. so we have a progression of 'n' terms, which is calculated by a((r^(n+1)-1)/r-1)) [url]http://en.wikipedia.org/wiki/Geometric_progression#Geometric_series[/url] | |
Re: Search for the problem on the net before posting. [url]http://www.dreamincode.net/forums/showtopic81897.htm[/url] This is a good way of doing it, | |
Re: not only dummyarray but also the int array [icode] hit[/icode] Should also have a specific size. | |
Re: This mostly appears when you have not specified main to return a certain type, Though that is just in general , It would be better if you would post your code down. [code] main(){//Causes the error [/code] [code] int main(){//No Error, [/code] Though that is pretty generalised, Hope its the … | |
Re: [code=c++] node *Find_Empty_Node(node* root) { int index = 0; if(root) { if(root->data == 0)//<--I want this child return tree->child[index]; for(int i = 0;i<root->child.size();i++) { index = i; return Find_Empty_Node(root->child[i]); } } return tree; } [/code] Shouldnt this be the way to do it? I mean return the Empty Node as … | |
Re: Well to start of with [CODE=C++]void getName(char* dump){ strcpy(dump,name); } [/CODE] Only copys the variable name which is your private variable into dump. That way the user would only recieve a copy of your private member and not get access to it . [code=c++] void getName(char* dump) const{ strcpy(dump,name); } … | |
Re: >>I was asked some interesting validation questions like: >>Creamy or Crunchy? I answered crunchy (you have to be pretty deep American to even understand the question). What does that mean by-the-way ? :) | |
Re: I dont think there is a determinant for a non-square matrix. [url]http://en.wikipedia.org/wiki/Determinant[/url] You can look at Lebnitz formula. Its easy to write. | |
Re: Timb i guess you should [code] return isPalindrome(s.substr(1,s.length()-2)); [/code] | |
Re: [code] int Poly::coefficient(int power){ for(int i = 0; i < 10; i++){ i++; //increment i to skip over coefficient if(poly[i] == power){ return poly[i - 1]; } } [/code] What does the function return if your value is not found? And secondly Though I understand the code. I am pretty … | |
Re: Childen is of type vector. I think that you should use [icode]push_back(value);[/icode] to handle that. | |
Re: Welcome to the forum Vishal, Your question is very faint for us, without knowing your actual implementation. Please post example codes so we can have an idea about what exactly your problem is. | |
Re: Lol , My Enter/Return key is currently broken. So i got used to pressing the Enter key at the Number Panel. | |
Re: Lol. Firstly there is an issue. You donot know the size of the char* and therefore i dont think that you might consider creating a char without a particular size defined. And by the way if you know the size of the array of the char* wouldn't it be a … | |
Re: Lol use the automatic programme completer. That is available here: [url]http://www.daniweb.com/forums/announcement8-2.html[/url] The above post was in regard to the title of your thread. Now, I would like you to rephrase your question and ask us for help if necessary. Apart from that you will need to tell where exactly are … | |
Re: Shouldnt pointer be destructed using a [icode]delete [];[/icode] and not [icode] delete;[/icode]? | |
Re: This is almost like a Implementation that I have made a few days ago. Though My Objective was not on Addition and Subtraction But Multiplication of Large Positive Integers. mimio, For doing this , I think the main objective here is to teach addition or subtraction to the computer. Just … | |
Re: C++ has a wide variety of Container Classes. Each Container Class has its suitability for diffirent operations. For Example : a [icode]vector[/icode] found in [icode]#include <vector>[/icode] Is a container. Apart from that there are many of these containers such as Stack or Queue etc. >>"Please let me know how can … | |
Re: Firstly from the question arent you supposed to read from "data.txt" and not "read_data.txt" Secondly. I am quiet confused with your code. You should first post all the Numbers into the file and then read in from the file again to perform math calculations ? | |
Re: Google is your friend. [url]http://www.mathlinks.ro/viewtopic.php?t=277509[/url] [url]http://en.wikipedia.org/wiki/Divisor_function[/url] I guess you can use that there. :) I guess you guys need it for the coding competition. [url]http://www.codechef.com/JUNE09/problems/D1/[/url] | |
Re: I guess the solution can be calculated in the following way as well. [code] int x=0; int number=10000; while(number!=0) { number=number/5; x+=number; } [/code] | |
Re: Donot post C - Code in the C++ Forum. Secondly. Please show what you have come up with .... I mean post the code that you have tried. with looping mechanisms.. EDIT: ALSO USE CODE-TAGS [ CODE ] [/ CODE ] | |
Re: [code] #include <iostream> using namespace std; int main() { int num = 9; cin>>num; char x=num; cout<<x<<endl; } [/code] Try that code out entering a certain number each time. Conversion is implicit , I think if a number is inputted and number >255, Then char x=(char)number%255; Is what takes place. … | |
Hey All, I have purchased a new PSU for my computer which is running on an Intel D845GVSR with Intel Pentium-4 Processor. The Problem is that , When I power up my computer The Fans(Ventilation Fans ) spin once and stop. When i contacted my vendor regarding this. It seems … | |
Re: [CODE] char action; cout<<"how many?"; cin>>action; if(sub_choice(action)) { while (action == 'C') { Customer *CUST = new Customer; int count = 1; CUST->lineNumber = count; count++; CUST = CUST-> next; } } [/CODE] You get a Infinite Loop because the value of action doesnt change once you give the input … | |
Re: However in this Both the terms almost mean the same thing. Just see that The do while loop first executes the whole block and then gets to the condition! | |
Re: Learn to DEBUG!!! There are many debuggers out there learn to use them and run your programmer in debugger mode. | |
Re: I guess the best way to know is to test it! Put a try block to catch all and enter an invalid file. See what happens? | |
[code=c++] void func(char*,int&);//A function returning no value and taking a char and reference to int as arguments. typedef void (*PTR)(char*,int&);//A pointer to function returning no value and taking a char and reference to int as arguments. void Func2(PTR);//A Function taking such a pointer as argument. PTR Func3();//A Function returning such … | |
Re: Firstly what do you mean by initialisation mechanism. If you are trying to pre initialise your vector. The best way to do it is through a constructor. Check this site out [url]http://www.cplusplus.com/reference/stl/vector/vector/[/url] | |
Re: Well when the page loads up. You SHOULD CHECK OUT THE source and see for the names of the forms. then you can write something like this "http://www.some.some/login.php?FORMNAME1=Username&FORMNAME2=Password Replace formname with the actual form names in the source and User Name and password with your user names :) | |
Re: Please post your code and then ask where you require help? | |
Re: >>can someone enlighten me? Lol, I donot know about enlightening, but do know where the error is. You have defined a function [code] Account operator +(const Account &rhs,double i) [/code] What Salem means to say is. In the declaration of Class Account. You have not added the "PROTOTYPE" or declaration … | |
| |
Re: Apart from that . The using of new operators and not deleting them is causing a memory leak everytime you run your code. | |
Re: >>Help me solve this problem, dont worry, im just starting out so its all very basic...and easy to you guys, i would imagine. I'm already worried , But anyways here is my solution [url]http://www.daniweb.com/forums/announcement8-2.html[/url] | |
Re: [code] for (long int j=1,n=1; n,j <= i; j++,n++) //for loop for PI SERIES 4 { // loop start if (j>=2) //if staytment to check the j counter n++; // n=n+1 if the j>=2 serieValue3+= pow(+1.0, n-1)/pow(n,2.0); // Calculating pi of the 4trd series with for loop value of p … | |
Here is a comment stripper program from which takes input from Cin and removes the comments. [CODE=C++] #include <iostream> #include <fstream> char Getchar(); char var; int main() { char ch; do { Getchar(); switch(var) { case '/': switch(Getchar()) { case '*': Getchar(); while(true) { if(var=='*'&&Getchar()=='/') { break; } else { … | |
Re: [url]http://www.daniweb.com/forums/announcement8-2.html[/url] Please read the above. Here at Daniweb You need to post your code and then tell us where exactly you have a problem . ![]() |
The End.