Forum: C++ Oct 24th, 2009 |
| Replies: 2 Views: 260 Yes, post down your code and tell us what you've problems with to achieve. |
Forum: C++ Oct 20th, 2009 |
| Replies: 3 Views: 283 It would be helpful if you posted your code.
(don't forget the code tags (http://www.daniweb.com/forums/announcement8-3.html)) |
Forum: C++ Oct 19th, 2009 |
| Replies: 5 Views: 280 The constructor is called when (= at the time) an object of a class is created.
The object's destructor is called at the time the object is destructed.
When you've manually allocated memory inside... |
Forum: C++ Oct 19th, 2009 |
| Replies: 2 Views: 529 Quick help is always possible here on Daniweb, but there's one major exception... (http://www.daniweb.com/forums/announcement8-2.html)
Double post:... |
Forum: C++ Oct 19th, 2009 |
| Replies: 10 Views: 2,010 >Sorry about the reply... I didn't see it was a 6 month old thread resurrected... just answered it...
Never mind, any input is welcome.
>All I wanted just reduce the number of local variables.... |
Forum: C++ Oct 17th, 2009 |
| Replies: 4 Views: 275 Those codes are called backslash codes (or character escape sequences), there's a quite logical reason for why they exist:
What for example when you want to have a string containing a newline or... |
Forum: C++ Oct 17th, 2009 |
| Replies: 6 Views: 340 http://www.parashift.com/c++-faq-lite/newbie.html#faq-29.17 |
Forum: C++ Oct 13th, 2009 |
| Replies: 6 Views: 618 No offense, but I'm not an "avaricious" person like others, I'll do it for only $500 :P
(that's 200 times cheaper than Ancient Dragon's offer :)) |
Forum: C++ Oct 11th, 2009 |
| Replies: 6 Views: 618 Don't use l33t speak here (http://www.daniweb.com/forums/faq.php?faq=daniweb_policies).
Let's see what my dictionary says about the word 'urgent': Anyway, read these and eventually come back when... |
Forum: C++ Oct 10th, 2009 |
| Replies: 7 Views: 392 http://www.gidnetwork.com/b-61.html |
Forum: C++ Oct 10th, 2009 |
| Replies: 3 Views: 268 First off you need to decide whether you're going to use the copy (Windows) or cp (Linux, Unix) shell command for copying the file or whether you're manually going to write the file copy routine in... |
Forum: C++ Oct 10th, 2009 |
| Replies: 16 Views: 15,271 Fibonacci in its recursive flavor:
int fib(unsigned n) {
if(n <= 1) return n;
else return fib(n-1) + fib(n-2);
}
( returns the nth element of the Fibonacci series )
Or even shorter: |
Forum: C++ Oct 2nd, 2009 |
| Replies: 4 Views: 272 I've always found it simpler to allocate a one-dimensional array, and then calculating the row and column manually, it's an easy approach, and it works. |
Forum: C++ Oct 1st, 2009 |
| Replies: 0 Views: 758 A roman to decimal converter, no validity checking, so inputting an invalid roman number will certainly just yield a wrong result. |
Forum: C++ Sep 25th, 2009 |
| Replies: 4 Views: 320 First thanks to add code tags to your post.
Second, (and I know this may sound harsh): your code is the ideal example of how one shouldn't program it, but no fear, we're here to help you and give... |
Forum: C++ Sep 25th, 2009 |
| Replies: 4 Views: 320 Ouch, my eyes!!
Please use BB Code and Inlinecode tags (http://www.daniweb.com/forums/announcement8-3.html)
What's the deal with void main()?... |
Forum: C++ Sep 21st, 2009 |
| Replies: 8 Views: 588 Since cake is a character array, the following instruction will allow an array overflow (in case there are more than 80 characters entered):
cin >> cake;,
you can prevent this by for example using... |
Forum: C++ Sep 20th, 2009 |
| Replies: 6 Views: 1,516 I already know this kind of game: we make suggestions and never it's a good suggestion because either it's too difficult, or too easy, or too boring, or whatever else.
You know what you can and... |
Forum: C++ Sep 20th, 2009 |
| Replies: 5 Views: 264 Great, you've got some code, and what exactly is your question? |
Forum: C++ Sep 19th, 2009 |
| Replies: 8 Views: 588 Post down your code please. |
Forum: C++ Sep 13th, 2009 |
| Replies: 36 Views: 1,406 This won't fix your problem, but it will fix a memory leak:
if you write this in your code: char *cool=new char[20];//the name pointer then at some point in future your program doesn't need the... |
Forum: C++ Sep 12th, 2009 |
| Replies: 36 Views: 1,406 Could you provide us with the file you tried to encrypt/decrypt using your program? |
Forum: C++ Sep 12th, 2009 |
| Replies: 36 Views: 1,406 Oh yes, and how do you explain the several minutes difference between all those posts then?
The post above this one (if not already removed by a moderator) is just the evidence that it hasn't... |
Forum: C++ Sep 12th, 2009 |
| Replies: 36 Views: 1,406 Okay, I really have enough of your double postings in your thread:
a) you won't get help faster by doing this
b) you just make your own thread unreadable
c) you waste your time, use that time to... |
Forum: C++ Sep 12th, 2009 |
| Replies: 9 Views: 974 if(currentChar<(char)'0' || currentChar>(char)'9'){
cout << "Invalid Pin" << endl;
}
Explicitly casting to a char isn't even needed here, the following code is equivalent:
if(currentChar<'0'... |
Forum: C++ Sep 12th, 2009 |
| Replies: 9 Views: 974 I guess you mean all characters other than 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 when you say: any non-numeric character.
Why not just get your number like this:
int num;
cout << "Enter a number: ";
... |
Forum: C++ Sep 10th, 2009 |
| Replies: 12 Views: 517 |
Forum: C++ Sep 10th, 2009 |
| Replies: 12 Views: 517 Yea, but if you write it like this: if(1 = a) your compiler will report it as an error, saving you much headache :P |
Forum: C++ Sep 9th, 2009 |
| Replies: 36 Views: 1,406 How I would go trough the process of designing such a program:
Create a simple menu, which will allow the user to choose whether he wants to encrypt or decrypt. (you've done this)
Create two... |
Forum: C++ Sep 8th, 2009 |
| Replies: 36 Views: 1,406 Is that the only reason you want to undertake all the work to write an encryption program?
Even if TrueCrypt is available for Linux as well ? |
Forum: C++ Sep 8th, 2009 |
| Replies: 36 Views: 1,406 As far as I know I only used cout, which you also did (you even mixed C with C++ I/O (which is also OOP), so I don't see where the problem is :)
Do you want to rewrite the whole program in C or... |
Forum: C++ Sep 8th, 2009 |
| Replies: 36 Views: 1,406 First of all I want you to NOT PM me with your questions to do it for you, it won't work, I'm a free person and I'm free to do what I want, and not to do what I don't want (let that be clear).
What... |
Forum: C++ Sep 6th, 2009 |
| Replies: 7 Views: 620 Right what I was thinking, you need to tell your compiler what code you want to associate with the if-statement, so this is incorrect
cin >> KeysPressed;
if (KeysPressed=="K");
cout << "you... |
Forum: C++ Sep 6th, 2009 |
| Replies: 7 Views: 620 I don't get that, what do you mean by this?
I think I got it :)
Could you otherwise post the code of your whole program?
For now I can only guess that it has something to do with the semicolon... |
Forum: C++ Sep 6th, 2009 |
| Replies: 7 Views: 620 The part on how to fix it:
I see you want to compare a string-variable with a string literal, but you're doing something wrong: you're using the =-operator, this operator is also called the... |
Forum: C++ Sep 6th, 2009 |
| Replies: 17 Views: 735 Well, you know the text editor? I meant: the program where you write your code in, launch that program, open the file containing the code of your program, copy that code, and paste it in a new post... |
Forum: C++ Sep 5th, 2009 |
| Replies: 17 Views: 735 To the OP:
No offense, but I can't trust the code you posted down.
Wait, let me explain, I came across a line which looked quite strange to me, and which will never let me compile this program:... |
Forum: C++ Sep 5th, 2009 |
| Replies: 17 Views: 735 Could you maybe explain us first what the goal of the program you posted is? (I mean: what output do you expect, etc.)
To answer the question in your signature:
Start a new thread about the bug... |
Forum: C++ Sep 4th, 2009 |
| Replies: 3 Views: 228 Just check out that thread again, look up the book on amazon, and read the reviews, isn't that simple? |
Forum: C++ Sep 4th, 2009 |
| Replies: 3 Views: 228 Ever considered to read this (http://www.daniweb.com/forums/thread70096.html)?
Accelerated C++ (http://www.amazon.com/exec/obidos/tg/detail/-/020170353X/102-1792473-1871307?v=glance) is generally... |