518 Posted Topics
Re: I used GTK+ in my application in C++, It provided me with a greater control over my GUI. But that control came over the price of a very ugly looking code for a typical C++ programmer. Anyways, I managed to separate the GUI in different modules, So it didn't create … | |
Re: You are talking about coding standards. Learn This first:[url]http://www.parashift.com/c++-faq-lite/coding-standards.html#faq-27.1[/url] Some coding standards :[url]http://geosoft.no/development/cppstyle.html[/url] and [url]http://geosoft.no/development/cppstyle.html[/url] | |
Re: Simple: Take the input as a string. Then parse it to perform the desire operation. | |
Re: Bots often require high level language interface. If you have choices about programming language, use python; It will keep you away from tangling the syntax and concentration on the core of logic. | |
Re: Use the functions qualified name i.e. class_name::function_name(parameteres) In your case, call it as: [icode]Point::DisplayName()[/icode] This will make clear that DisplayName is either a static function from a class Point or it is a Simple function in the Point namespace. If the code reader knows that Point is a class, he … | |
Re: Line 11: Do you expect, for a fraction, denominator to be zero? As per for the simplify(), It is simple: 1.Write a function that calculates the gcd of two number 2. Divide numerator and denominator by that GCD For finding GCD use the [URL="http://en.wikipedia.org/wiki/Euclidean_algorithm"]Euclidean Algorithm[/URL] | |
Re: >>I just mean, in my case, v1, v2 should be initialized in the constructor function or >>no Do don't need to construct vectors explicitly. When you define a vector a type T, the vector's constructor automatically calls the constructor of T for all the elements. This poses a restriction that … | |
Re: You are defining the class twice. Surely it cannot link. >>(Why the daniweb editor is not rich text?! I remember it was before) So as to make it tough for you to use color on every alternate word. Phew man! reading you post needed courage. | |
Re: If vectors are in your toolbox, you better use them: [code=cpp] int main(){ std::vector<std::string> vec1; vec1.push_back("Hello"); vec1.push_back("How"); vec1.push_back("are"); vec1.push_back("you"); f1(vec1);//see definition below } void f1(const std::vector<std::string> & vec) //a function taking vector as argument { for(int i=0; i!=vec.size();++i) { std::cout<<vec[i]; }//print the vector } [/code] | |
Re: [QUOTE=Stinomus;868367]I agree with Ancient Dragon. Check the sizes of the arrays (if they aren't equal then you can bail right there) If they are equal then sort them. Then a basic loop: [code] bool is_equal=false; for( int i=0; i<array_size; ++i ) { is_equal=(a[i]==b[i]); } [/code][/QUOTE] Your code will check if … | |
![]() | Re: For Network Programming, I suggest you Read [URL="http://www.amazon.com/UNIX-Network-Programming-Networking-Sockets/dp/013490012X"]Unix Network programming by W. Richard Steven[/URL]s. Its really a awesome book. Also, I would suggest you to go through [URL="http://beej.us/guide/bgnet/"]Beej's Networking Tutorial[/URL] As far as Anti Virus Programming is concerned, I don't really have an idea. You may (obviously) start searching google. |
Re: >>Or Have you tried? He don't have to as your advices are very incorrect. To the OP: There is NO WAY you could get the size of an passed array inside a function. Why? Because arrays cannot be passed. The compiler converts the definitions like this: [code]void f1(int a[]) { … | |
Re: 1.Seed using srand() Visit [url]http://www.daniweb.com/forums/thread1769.html[/url] 2.Computer can only generate pseudo random number. Understand the difference. Please visit [url]http://www.eternallyconfuzzled.com/arts/jsw_art_rand.aspx[/url] | |
Re: >>And when I do Visual Studio 2005 reports: Thats because you are still appending a SportsCar in the list while it requires a Pointer to SportsCar. So change [icode]listname.push_back( *ptrToSportsCar ); [/icode] to [icode]listname.push_back( ptrToSportsCar ); [/icode] | |
Re: I don't think you would like rounding the number the use inputs. You will loose on the accuracy of your result. What you want may be is that when your display the output, the precision should be only 2 digits. Do something like this: [code=cpp]#include<iostream> #include<iomanip> int main() { double … | |
Re: Template parameter are instantiated pre-runtime. So when your program is running, you cannot change them. If you are making a Matrix class, why don't you consider vector or vectors as the backend data structure. Then make your own resize function. Alternatively, you can create a copy constructor. Then, when you … | |
Re: You are almost there: start of with this: [code=cpp] #include <iostream> #include <string> using std::cout; using std::cin; using std::string; int main() { // write the code to Declare PointsScored [10] of reals // Reals are represented as 'double' in c++ // write the code to Declare sum, average as real … | |
Re: Isn't this the assignment similar to this one? [url]http://www.daniweb.com/forums/post864074.html#post864074[/url] Read my post: [url]http://www.daniweb.com/forums/post864074.html#9[/url] I have posted the algorithm. Try to implement it and let us know | |
Re: The type of p[i] is obviously a pointer-to-int. While the type of p is pointer-to-pointer-to-int. The type of *p[i] and p[i][j] is an int. vmanes>>So, each p[i] is the name of a single 1D array of int. Actually, because of the infamous analogy of pointer and arrays, few often ignore … | |
Re: The God has sent me to say "C++ compiler is not a pocket calculator." | |
Re: >>I need the answer as soon as you can We need your to leave this website as soon as you can. Or: Read the forum guidelines ( I usually posts the link along but for you, no mercy) Read the sticky thread by Narue: Read before posting Read the Forum … | |
Re: Just helping you out by compiling all the fact that has already been posted. 1. Find the squares of lengths a,b,c by using distance formula : [tex]d^2=(x_{1}-x_{2})^2+(y_{1}-y_{2})^2[/tex] 2. Check if the greatest of the three square is equal to the sum of the square of other two sides. [tex]a^2=b^2+c^2 \forall … | |
Re: You have not written a recursive function. Loosely speaking, Recursive functions should imply removal of ugly loops. I shall rather guide you in your first function. You are using while to check an condition rather than if. This is unlikely (and maybe wrong too) by your instructor. Here is a … | |
Re: Short answer: You cannot. Long answer: You cannot stop anyone from copying your program (until unless your seize its production). You can only make it harder for the user to reverse engineer your application. Now as per the last part, your can have various check about the authenticity of the … | |
Re: Line 42, defination of function is not proper. The second formal parameter is missing. Returning of array doesn't makes sense. As arrays passed are mutable in nature. Any changes applied to arrays inside a function is reflected back to the caller. So sales_total doesn't return anything. sales_input should also doesn't … | |
Re: follow djextream5. Visit [url]http://www.nychold.com/em-arith.html[/url] for more algorithms on basic mathematical operations | |
Re: You need to know a virtual function : [url]http://www.parashift.com/c++-faq-lite/virtual-functions.html#faq-20.1[/url] Thats perhaps your best shot. | |
Re: Second statement is wrong. You must have not seen it in many codes. There is no function called fopen for the istream class. This line should have been: ipfile.open(ipfname); | |
Re: Read: [url]http://www.learncpp.com/cpp-tutorial/94-overloading-the-comparison-operators/[/url] | |
Re: >>That is incorrect. The pointer is assigned whatever random value is at that >>memory location. For example char *ptr; the address of ptr is whatever is at that >>memory location on the stack (assuming its not a global variable). It is never >>auto set to NULL by the compiler in … | |
Re: I am not sure if I understood the your question. Unordered and random codes are nightmare for the new programmer.It is really unfortunate situation and your are suffering from this. Now I would advice you to either find that bloody programmer who wrote all that. Or try to scratch your … | |
Re: nothrow is a (ad-hoc) way to control program flow. As you may be clear, no throw does not throw exceptions. So you get the old C type check rather than the great exception handling mechanism. | |
Re: Learn C, Learn C++ Do the conversion manually. Or try this [url=http://lmgtfy.com/?q=c]link[/url] to c++ conversion | |
Re: >>Using Windows API's how can i >>copy to another file and Get different properties of a file (size, type, date >>created and more). Try reading :[url]http://www.dreamincode.net/forums/showtopic93676.htm[/url] Try googling before starting new thread. Don't over post on web, it will blast eventually. >>plz Thats good. >>someone reply me quickly Thats not … | |
Re: Python has a great support of internet. If you want it do it C++, things can go messy. If you are to only develop apps for MS Windows, they have winsock library. Use it. For cross-platform support Boost's Asio is a good one. Best of luck | |
![]() | Re: >>Dear NathanOliver, your code is working perfectly after changing.............. It may be working on your implementation but the code is in a state of undefined behavior. >>Edit:: Some additional information on if (test != input) as 'input' is a double >>and 'test' is an integer, 'test' will be implicitly converted … |
Re: [I]A prime number is a number which when divided by every integer greater than one and less than itself, will never leave the remainder zero.[/I] Now check out your for loop. Is this what your for-loop checks? No. So, re frame your for-loop. | |
Re: >>I'm currently using the new borland so this is a correct syntax after all it's >>working on my computer, as for the variables i am on writing description for >>everyone of them. This is a wakeup bell for all those who are using Old compilers ( like the OP is … | |
Re: This one from official Python Tutorial: [url]http://docs.python.org/tutorial/introduction.html#first-steps-towards-programming[/url] This one from Gods own website: [url]http://lmgtfy.com/?q=while%20loop%20in%20python[/url] | |
Re: [QUOTE=Monkey.D.Luffy]Does anyone know how to write a simple crading system in C++ programming???[/QUOTE] Yes I know | |
Re: For the first one Read:[url]http://www.research.att.com/~bs/bs_faq2.html#constraints[/url] Arrays do not have variable size. Use vectors of vectors. Define your struct as : [code=cpp]struct graph2D { int id; std::vector< std::vector<bool> >matrix ; //there is a space between > > } [/CODE] This way you would never need to initialize it's size. If you … | |
Re: >>It's not the best method to learn language: waste a time in asking help on >>forums instead of read elementary textbook on a very basic language concept. Absolutely. To OP: You have declared a [U]integer variable[/U] called [I]inches[/I] and not an array. Another point is : Always initialize your variables … | |
Re: Your problem is with the way you're compiling your program. In g++, compile your code as : [icode]g++ -o OUTPUT.EXE SingletonMain.C Singleton.cpp[/icode] This is not an compiler error but a linker error. Your linker do not have access to Singleton.cpp hence he doesn't have definition of Singleton<T>::instance() hence the error. | |
Re: >>My compiler is also saying that with a virtual function I need a virtual destructor, >>how do I right that? LOL, I just wished my compiler was [I]that[/I] smart. | |
Re: I think the book is pretty much fun. Though being a Linux(which it originated from MINIX which in turn originated from UNIX) user, I have my full sympathy and support over UNIX, But the book is really hilarious. Thats it. Nothing more. UNIX has changed the meaning of OS. No … | |
Re: >>Im using my colleges "dos style" environment to program in and it does not let me >>copy and paste outside of that program You mean something like Turbo C++? Well, every compiler stores the while somewhere or the other. You you can definitely copy-paste the code if you are able … | |
Re: >>actually i wrote it myself... your negative and untrue comments are not any help >>at all... They are actually helpful. These comments might not solve this problem, but it will help you in long run. Copying the code which you don't understand is not expected from a good programmer. There … | |
Re: Thats a 100X50 matrix. Means that the array should be of 5000 elements. If I we assume that each int takes 4bytes, that makes 20000 bytes nearly equal to 20Kilo Byte. Anyways, here is what you can do. 1. Create an array of 5000 elements. say int arr[5000] 2. Read … | |
Re: Why not just use [URL="http://www.cplusplus.com/reference/clibrary/cctype/isalpha/"]isalpha[/URL]? [edit] Sorry I didn't saw ahlamjsf's solution. It was so that I had been amazed (shocked) by looking already posted pathetic codes above. | |
Re: Well, you may record the sound to a file. Then use some hashing algorithm ( like md5sum) to calculate the hash number of that file. Each different type of sound will give you different files. And if two files are different, their md5sum hash will of course be different. |
The End.