Forum: C++ Jul 19th, 2007 |
| Replies: 6 Views: 19,264 Bench has given a good suggestion. But if you are not allowed to use maps, try using two parallel string arrays in which the location of the name of the animal and its description resides in the same... |
Forum: C++ Jul 19th, 2007 |
| Replies: 7 Views: 895 Mauro, more than 30 posts and you still don't use code tags? |
Forum: C++ Jul 19th, 2007 |
| Replies: 6 Views: 9,395 > Why?
Answer. (http://www.daniweb.com/forums/post191618-8.html) |
Forum: C++ Jul 16th, 2007 |
| Replies: 62 Views: 11,452 Dump the loops, what you need is a recursive algorithm which would work for arbitrary lengths of arrays. One of the way is using 'Heap Permute'. Here is a sample program which you can easily adapt to... |
Forum: C++ Jul 4th, 2007 |
| Replies: 9 Views: 2,481 You end up removing the fourth character instead of the third one. Doing if(i % 3 == 2) would solve the problem.
But I still think that removing third character from each _word_ is different from... |
Forum: C++ Jun 25th, 2007 |
| Replies: 14 Views: 1,387 Here (http://norvig.com/21-days.html) is something for those people who think that 'Teach yourself xxx in yy days' can do them any good.. |
Forum: C++ Jun 21st, 2007 |
| Replies: 9 Views: 3,128 > I have the basic knowledge in C++ and C.
Better start off with some console based games. They would help you in concentrating on the logical aspects of the game without wasting your time in... |
Forum: C++ Jun 12th, 2007 |
| Replies: 5 Views: 20,085 A common solution to this problem is to pass around the array size along with the array. That way, it would work for all types of arrays, not just C style strings (char arrays with terminating null... |
Forum: C++ May 22nd, 2007 |
| Replies: 14 Views: 3,587 > So, multitasking is a more simple concept of multithreading?
Mutitasking is what your operating systems are packed with. You have the ability to execute more than one tasks / processes. You can... |
Forum: C++ Mar 19th, 2007 |
| Replies: 11 Views: 2,194 Maybe something like this:
double factorial (double value)
{
double result = 1.0;
while (fabs (value) > 0)
{
result *= value--;
} |
Forum: C++ Mar 19th, 2007 |
| Replies: 11 Views: 2,194 Maybe you need to look a bit harder at the code I posted. It takes care of changing the flag variable. Look out for the part posted in bold... |
Forum: C++ Mar 13th, 2007 |
| Replies: 10 Views: 2,134 You can save iterations and the additional checking performed in the loops by doing something like:
#include <iostream>
int main ()
{
using namespace std ;
int limit = -1, count... |
Forum: C++ Mar 9th, 2007 |
| Replies: 6 Views: 8,594 I guess I did post a similar code (http://www.daniweb.com/techtalkforums/post326797-9.html) in another thread.... ;) |
Forum: C++ Feb 3rd, 2007 |
| Replies: 10 Views: 3,854 ...which even can be solved with a really simple loop.
Since the langugages in which we program are normally turing complete, there is as such nothing which can only be solved using recursion. A... |
Forum: C++ Feb 2nd, 2007 |
| Replies: 9 Views: 2,194 Categorization is for the weak minded people who need a reason to learn a lanaguage. Programming is an art and language are the tools for artists.
Of course if given a problem domain and the... |
Forum: C++ Jan 20th, 2007 |
| Replies: 24 Views: 65,717 Hello to all programmers out there. Considering the growing request for practice problems by the beginners, we ( Me, Joey, Niek, Aaron..) have decided to start a sticky which will host some common... |
Forum: C++ Jan 7th, 2007 |
| Replies: 25 Views: 3,835 I don't know Mr. Jobe if you already know this but there is a book which presents the solutions to the problems posed in C++ Programming Language, you can get it here... |
Forum: C++ Jan 2nd, 2007 |
| Replies: 11 Views: 2,695 Ravalon, have you enabled all the warnings in your compiler settings (-Wall) since the above flags a warning saying "error: no matching function for call to `random_shuffle(<anonymous struct>[52],... |
Forum: C++ Dec 23rd, 2006 |
| Replies: 14 Views: 3,687 Its actually the reverse, delete will remove or deallocate the data pointed by new and not delete the pointer. Simply put, will send the portion of allocated memory to the free store.
It is... |
Forum: C++ Dec 18th, 2006 |
| Replies: 3 Views: 3,762 I don't blame you, since what you encountered is one of the C++ gotchas and not many starters know about it.
What you are trying to do here is to create a function which will befriend all the... |
Forum: C++ Dec 8th, 2006 |
| Replies: 10 Views: 1,978 Hello.
Actual arrays can't be resized, what you are talking about is data pointers being allocated enough memory to be used as arrays.
The important differentiation here being used as arrays... |
Forum: C++ Dec 5th, 2006 |
| Replies: 10 Views: 2,261 Hmm...here is what I think you should do:
1. Always keep a guard condition while making header files which does away with the problem of recursive inclusion of headers. Something like:
#ifndef... |
Forum: C++ Nov 23rd, 2006 |
| Replies: 28 Views: 3,644 Keep tab or print out the array after each iteration to give yourself a better understanding of what exactly is going on.
BTW your first swap function doesnt do anything, I'll leave it to you to... |
Forum: C++ Nov 19th, 2006 |
| Replies: 9 Views: 1,613 I have read this somewhere in the context of Processor architecture. The compiler tries to align the data and the pointers along the boundaries i.e. in multiples of 4.
So the addresses are given... |
Forum: C++ Nov 1st, 2006 |
| Replies: 8 Views: 2,818 Naa you aint defining the default constructor, you are just declaring it in Complex.h but its defination doesnt occur in Complex.cpp, thats the whole root of the problem.
Implement one in... |
Forum: C++ Oct 31st, 2006 |
| Replies: 48 Views: 8,757 Okay buddy, what exactly your intension is ? You have been recommended books in the prevoius posts by Mr. Dragon and Mr. Joe. Refer the previous posts for answer to your question.
I'll tell you a... |
Forum: C++ Sep 29th, 2006 |
| Replies: 9 Views: 1,673 If you have a dilemma post the real question to your dilemma instead of being vague all over. And whats up with this kind of attitude? Maintain it and you would be sure to make a lot many friends... |
Forum: C++ Sep 29th, 2006 |
| Replies: 5 Views: 2,733 Try out something like:
#ifndef SAVINGSACCOUNT1_H
#define SAVINGSACCOUNT1_H
class SavingsAccount
{
private:
float annualInterestRate; |
Forum: C++ Sep 29th, 2006 |
| Replies: 10 Views: 2,779 If you want the program to recover the files which you deleted by mistake then you are posting in the wrong forum but still can take a look here:
... |
Forum: C++ Sep 28th, 2006 |
| Replies: 6 Views: 3,214 Yes its possible I may be wrong but lookign from his code and the limited senario he has painted in front of me, i thought maybe he didnt know about preorder and needed some direction. But then again... |
Forum: C++ Sep 28th, 2006 |
| Replies: 2 Views: 1,096 The things marked in red by me are the culprits. WHy dont u format the code properly so that typographic errors will be minimised. Do you write your code in Notepad. If so grab your self a syntax... |
Forum: C++ Sep 27th, 2006 |
| Replies: 6 Views: 2,822 I think you are getting the formulas for deviation and variace wrong.
See this code for reference;
#include <iostream>
#include<iomanip>
#include <cmath>
using namespace std; |
Forum: C++ Sep 27th, 2006 |
| Replies: 6 Views: 2,822 I think you gettting the fundamentals of programming wrong. Why you taking in the number of elements entered by the user into an array. Why not just use a simple int variable like "total_numbers".
... |
Forum: C++ Sep 27th, 2006 |
| Replies: 6 Views: 2,304 Since i dont know a lot about all this i cant say anything definate but here are some of the links realted to CURSORS and Oracle and mysql.
http://www.sqlapi.com/Examples/refcursors.cpp... |
Forum: C++ Sep 26th, 2006 |
| Replies: 5 Views: 5,662 Please explain the problem clearly so that we can help you out. Post your entire code along with the problems you are encountering.. whether it is compile time error or run time error or the program... |
Forum: C++ Sep 26th, 2006 |
| Replies: 12 Views: 2,112 What have you attempted till now, post it here so that we can set your logic right and make you understand things more clearly. |
Forum: C++ Sep 26th, 2006 |
| Replies: 6 Views: 2,304 Dont know what exactly you want but if you want some tuts on interfacign MySQL and C you can visit some of the links given below:
http://www.tol.it/doc/MySQL/... |
Forum: C++ Sep 25th, 2006 |
| Replies: 12 Views: 2,112 Hmm looks like your basics are a bit err.. shaky. You got most of the syntax there wrong. Why not revist the basics by learning something about C++ with good books. Some tuts here... |
Forum: C++ Sep 25th, 2006 |
| Replies: 1 Views: 880 What kind of optimization do you want to perform on this code, performance wise or lengthwise ? Please be more specific. |
Forum: C++ Sep 23rd, 2006 |
| Replies: 11 Views: 2,003 Maybe you can try out something of this sort and make it more robust and suiting to your own purpose.
using namespace std;
int main()
{
int number=10;
int your_number;
char... |