429 Posted Topics
Re: You would have to do a few things before someone can help you 1> post some code, show what you have tried 2> state the problem clearly so that we can try and get our heads around it. , state what's happening, what's expected etc.. | |
Re: You need to provide an implementation for all the arithmetic functions , something like this [code=c++] Fraction Fraction::Multiply(Fraction frac1) const // Pre: frac1 and self have been initialized. // Post: self - frac1 is returned in reduced form.are { // FILL IN Code. //multiply numerators from 2 fractions int num … | |
Re: Please state clearly what problem you are trying to solve and what are the difficulties you are facing. Don't expect us to read through your code and find out the problem. | |
Re: Oh God..not again .. I think we need a background script to find such threads and give suitable advice to the OPs' :( ... [I]We don't give homework help, if you show some effort, we will try to help you do it[/I] | |
Re: The way you have written your question, it is quite difficult to understand what you have and what you want to do. Can you re-phrase your question clearly? | |
Re: Since this is your first post, please read about code tags and learn to use them if you want people to read your code. [URL="http://www.daniweb.com/forums/misc-explaincode.html"]Read About Code Tags Here[/URL] There are some forum rules which can help you get good answers, much quicker. | |
Re: line 145, 147: you cannot just directly read user input into RationalNumbers variable (unless you do some operator overloading and I don't think you need to do that). Take it into a standard data type, may be an int or float in your case then call the RationalNumbers constructor with … | |
Re: By binomial coefficient you mean finding the combinatorial number, is that right ? So you should be using the formula n!/(n-k)!*k! for this the pseudocode should be numerator=1*2*3..*n fact1 = 1*2*3...*n-k fact2 = 1*2*3....*k denominator = fact1 * fact2 binomial coefficient = numerator/denominator can you code that? | |
Re: > start quote. for (int n = 0; n < adj2.length; n++) { for (int m = 0; m < adj2.length; m++) { for (int i = 0; i < adj2.length; i++) { for (int j = 0; j < adj2.length; j++) { path += adj[i][j]*adj[j][i]; } if (path > … | |
Re: This looks like a shortest path problem. You can consider each element to be a vertex in a graph (so you have 12 vertices for the first matrix) and only connected to vertices directly to right-left-top-bottom of itself in the vertex. The weight of each edge is the value in … | |
Hi, I'm writing my first RMI application, it's an auction system. At the end of the auction period for a particular item the server sends a 'callback' to the winning client telling him that he's won. It works fine till here, but after that i get this exception. It shows … | |
Re: 'tmp' string might be null. put a check like this after you do the 'readLine' and try [code=java] if(tmp != null) { //your code } [/code] | |
Re: Its surprising that you are not able to compile it in windows. If you take a library compiled in *NIX, it would not run on windows but usually the code compiles fine both on windows n *nix, apart from specific system calls if you have them. braces like error are … | |
Re: Unfortunately you havn't done enough to make us help u... you can find out a lot of material about tree traversal here, infact you can see similar threads at the bottom of this page too. Read them and you should be able to do a lot more than this. Post … | |
Re: [code=c++] matrixType::matrixType() { maxRow = 5; maxCol = 5; matrix = new int*[maxRow]; for (int row = 0; row > maxRow; row++) matrix[row] = new int[maxCol]; for(int i = 0; i > maxRow; i++) for(int j = 0; j > maxCol; j++) matrix[j][i] = 0; } [/code] how is the … | |
Re: honestly joe and mary don't really care what OS it is. A lot of them won't even know what's an OS. They would be happy with any, provided it does everything they want to do and doesn't make them waste time on fixing issues and putting patches. If what they … | |
Yesterday i saw the Microsoft’s table PC technology in one of the tech shows on TV and it kind of left me speechless.. Has anyone else happened to see it? It was just amazing, i know its going to cost a fortune but it definitely gives a picture of what … | |
Re: Is this the exact code you compiled? And is that the only error you got? Your code has a lot of other compiler errors too as of now. It'll be good if you paste the entire code after you remove all the errors that you can and then we'll be … | |
Re: I don't really understand what you are doing. You just have an array of structures of type wordList. So basically you are not using the linked list at all !!! You create a node and insert it into the array. I don't think that's how you would be expected to … | |
Re: This thread here talks about float comparisons. There's a good link available in the thread about the same. [URL="http://www.daniweb.com/forums/thread73810.html"]Thread1[/URL] | |
Re: you need to pass the reference to the pointer to make it work. You are just modifying the copy of the pointer here. So the changes will not be visible once you leave the fn. fn signature could be [code=c++]void to_lower(const char*& s)[/code] while calling you could do [code=c++] char … | |
Re: If you are compiling them one-by-one make sure you only compile and don't go to the linking process. I think you might be doing that and while trying to create an executable its not finding main. Read the compiler man pages and find the flag used to only compile and … | |
Re: [code=c++] void int_to_hex(int *dez,string& hex_string); [/code] | |
Re: [quote]they say its more simple than java,,[/quote] And who are 'they' ?? My opinion, C++ is way harder than Java, so don't start with wrong notions. | |
Re: 1->atoi signature is this: int atoi ( const char * str ); 2-> read some more threads here to find out alternatives to atoi. You should avoid using it. | |
Re: Before even going into your logic i have a couple of things I can tell you 1-> Read the code-tags page carefully and learn to use them correctly. it would make your code much easier to read. 2-> don't use 'void main' and old style includes <.h>. Use int main(). … | |
Re: Well i copied your class, created a class definition out of whatever was given and used it and it worked fine for me. [code=c++] #include <iostream> #include <fstream> #include <string> class RupLogger { public: RupLogger(); ~RupLogger(); void log(std::string msg); std::ofstream logfile; }; RupLogger::RupLogger() { logfile.open("log.txt", std::ios::out); } RupLogger::~RupLogger() { logfile.close(); … | |
Re: Hi...Thanks for a response. But, I am getting the following errors:- The errors occur when the program is as follows:- #include<iostream.h> #include<conio.h> void main() { long double a=100000000.0; cout<<std::fixed<<a; getch(); } Now weren't you asked to understand the difference between standard and non-standard c++ in some other post? you are … | |
hey guys, I have a fixed length .txt file. Values in the file correspond to columns in a db table. ex file row is something like: [B]India 3455 78787 89898[/B] table has columns something like: [B]column_name length startPosn EndPosn[/B] country 6 1 6 ID 6 7 13 so you see … | |
Re: Reading this code is a pain..Can you format the code properly and use the language specific code tags? Also please point the function where you are printing the contents. | |
Re: [quote]error C2664: 'List<TYPE,KTYPE>::_search' : cannot convert parameter 1 from 'NODE<TYPE> *' to 'NODE<TYPE> **'[/quote] I don't know what more it can tell you, if you read the error message carefully it says everything. _search needs a parameter of type NODE<TYPE>** and you are passing it NODE<TYPE>* , so either change … | |
Re: If you are passing the address of result then it's definitely a problem because you have not allocated 'result' on the heap. It's a local variable in the function Union and it disappears when we exit the function, if you try to access that address you can get run-time errors. | |
Re: what do you mean by 'read internet data' ? If it means making an HTTP 'get' request to some URL and getting the data that i think you can try using the 'curl' library [URL="http://curl.haxx.se/"]http://curl.haxx.se/[/URL] | |
Re: This is a first, a video problem ... what if the video was edited? :) .. Not a good way to learn programming I'd say ... | |
Re: Why don't you put some couts and check the values of 'Position' ? and btw you are leaking a lot of memory. | |
Re: did you try [code] try{ FloatValue a(INFINITE_VALUE); } [/code] | |
Re: You need to do 2 things 1> Post the exact error messages here 2> Use code tags for re-posting your code so that it can be easily read. | |
Re: And as a rule if your class defines any of these 3 then you probably need all the 3. 1> destructor 2> copy ctor 3> assignment operator so you can define a copy ctor as well for your class. | |
Re: So will you always have the same input or can it change? If it can change then what's the basis on which the pattern gets created? Do you need to follow some rules? | |
Re: First of all you need to decide if the parameter has to be passed by reference and hence changed or it has to be returned by the function and collected in main. Right now you're trying to do both but nothing is complete. The pointer is being passed by value … | |
Re: [quote]The only draw back is that at no point of time, the value of any expression exceed one digit.[/quote] unfortunately then it would fail to evaluate his original expression of 264+* ...right? | |
Re: I guess you can look at using the gnuplot library for simple graphs etc. i'm assuming you are working on *NIX | |
Re: You don't need to create 3 threads for the same problem. 1 would be enough. | |
Re: I don't think you will be able to use the same makefile across UNIX and Windows. What you can do is have 2 makefiles with different extensions like makefile.XP and makefile.Sun and have another sort of a base makefile included in all the makefiles that decides at compile time which … | |
Re: Also it will still tell you one less than the actual number of words in the sentence. Because you are counting the spaces not the words. eg Sentence-> I am a good boy spaces-> 4, word_count = 4 !! actual number of words = 5. You can increment word_count after … | |
Re: Not allowed to use the <string> header? | |
Re: That to me seems like a perfect example of what could go wrong if you don't define a copy ctor for classes which have pointers to memory on the heap. Shallow copy as you said will have the 'data' pointer of both the classes point to the same memory location. … | |
Re: >Immplementation for starters you can post well indented code within 'code tags'. like this(read the 'help with code tags') [code=c++] .. your code [/code] >but I'm having a problem about the main program.. secondly you can mention the exact problem you are facing so we can focus directly at that … | |
Re: I'm not too sure, but may be this might help. This was done on windows. [code=c++] #include <iostream> #include <string> using namespace std; int main() { string p; while (cin >> p != '\0') cout << p << endl; } [/code] > ls | ./myProg.exe | |
Re: malloc returns a void* to the memory allocated and you need to ensure that you type cast it to the correct type. |
The End.