518 Posted Topics

Member Avatar for Stefano Mtangoo

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 …

Member Avatar for Stefano Mtangoo
0
304
Member Avatar for QuintellaRosa

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]

Member Avatar for Ancient Dragon
0
80
Member Avatar for daviddoria

Simple: Take the input as a string. Then parse it to perform the desire operation.

Member Avatar for ArkM
0
86
Member Avatar for dazzclub

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.

Member Avatar for siddhant3s
1
123
Member Avatar for daviddoria

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 …

Member Avatar for siddhant3s
0
100
Member Avatar for goyofoyo

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]

Member Avatar for goyofoyo
0
116
Member Avatar for newcpp

>>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 …

Member Avatar for newcpp
0
7K
Member Avatar for CppBuilder2006

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.

Member Avatar for CppBuilder2006
0
332
Member Avatar for ShadowScripter

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]

Member Avatar for ShadowScripter
0
98
Member Avatar for gretty

[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 …

Member Avatar for siddhant3s
0
4K
Member Avatar for Dilbert137

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.

Member Avatar for tux4life
0
120
Member Avatar for Talguy

>>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[]) { …

Member Avatar for Narue
0
3K
Member Avatar for Lukezzz

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]

Member Avatar for Lukezzz
0
225
Member Avatar for Greeny28

>>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]

Member Avatar for Narue
0
141
Member Avatar for Akis2000

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 …

Member Avatar for Akis2000
0
143
Member Avatar for Talguy

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 …

Member Avatar for Talguy
0
91
Member Avatar for fbutler24

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 …

Member Avatar for siddhant3s
0
128
Member Avatar for SallyJ

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

Member Avatar for ArkM
0
2K
Member Avatar for MicrosoftMahmou

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 …

Member Avatar for MicrosoftMahmou
0
81
Member Avatar for kailisr
Member Avatar for WaltP
0
146
Member Avatar for naheesa

>>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 …

Member Avatar for siddhant3s
0
149
Member Avatar for gretty

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 …

Member Avatar for siddhant3s
0
1K
Member Avatar for blackhawk9876

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 …

Member Avatar for siddhant3s
0
110
Member Avatar for Liszt

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 …

Member Avatar for Liszt
0
104
Member Avatar for waehake

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 …

Member Avatar for NathanOliver
0
115
Member Avatar for sabian4k

follow djextream5. Visit [url]http://www.nychold.com/em-arith.html[/url] for more algorithms on basic mathematical operations

Member Avatar for siddhant3s
0
203
Member Avatar for ganmo

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.

Member Avatar for ganmo
0
114
Member Avatar for Mem21

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);

Member Avatar for siddhant3s
0
111
Member Avatar for bunnyboy

Read: [url]http://www.learncpp.com/cpp-tutorial/94-overloading-the-comparison-operators/[/url]

Member Avatar for bunnyboy
0
119
Member Avatar for BlackStar

>>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 …

Member Avatar for BlackStar
0
414
Member Avatar for serkan sendur

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 …

Member Avatar for serkan sendur
0
90
Member Avatar for tux4life

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.

Member Avatar for Ancient Dragon
0
217
Member Avatar for redmaverick

Learn C, Learn C++ Do the conversion manually. Or try this [url=http://lmgtfy.com/?q=c]link[/url] to c++ conversion

Member Avatar for vmanes
0
172
Member Avatar for bilawal420

>>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 …

Member Avatar for siddhant3s
0
75
Member Avatar for Bladtman242

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

Member Avatar for Bladtman242
0
145
Member Avatar for nicolap

>>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 …

Member Avatar for vmanes
0
208
Member Avatar for timb89

[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.

Member Avatar for timb89
0
76
Member Avatar for sinapse

>>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 …

Member Avatar for Salem
0
159
Member Avatar for tksrules

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]

Member Avatar for marium ahmad
0
85
Member Avatar for Monkey.D.Luffy

[QUOTE=Monkey.D.Luffy]Does anyone know how to write a simple crading system in C++ programming???[/QUOTE] Yes I know

Member Avatar for Sky Diploma
0
393
Member Avatar for Xamas

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 …

Member Avatar for twomers
0
178
Member Avatar for songweaver

>>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 …

Member Avatar for siddhant3s
0
135
Member Avatar for cppStudent

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.

Member Avatar for siddhant3s
0
139
Member Avatar for cbreeze

>>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.

Member Avatar for siddhant3s
0
97
Member Avatar for serkan sendur

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 …

Member Avatar for serkan sendur
-1
417
Member Avatar for Adexter

>>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 …

Member Avatar for Adexter
0
103
Member Avatar for lolaabbydawn128

>>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 …

Member Avatar for siddhant3s
0
134
Member Avatar for super.mina

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 …

Member Avatar for siddhant3s
0
276
Member Avatar for nhamyl

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.

Member Avatar for JameB
0
3K
Member Avatar for kelechi96

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.

Member Avatar for jephthah
0
456

The End.