Forum: C++ 1 Day Ago |
| Replies: 14 Views: 429 Seriously, "rafaqat hassan" and "littledani"
Read this (http://www.daniweb.com/forums/faq.php?faq=daniweb_policies)and this (http://www.daniweb.com/forums/announcement8-2.html) (the rules). If this... |
Forum: C++ 1 Day Ago |
| Replies: 14 Views: 429 So not only are you too lazy to do the assignments, you're even too lazy post the requirements here??
That's a new low for me. Really.
[edit]
Read this ... |
Forum: C++ 8 Days Ago |
| Replies: 2 Views: 160 I know that you're not a mod, but if you were a mod you'd probably move this thread.
I also know that I am a mod and split this thread and moved it to the C++ forum.
:) |
Forum: C++ 9 Days Ago |
| Replies: 14 Views: 2,163 When I read a post like yours, I always wonder why you reply. I mean, this thread hasn't had a reply in over 1.5 years, what gave you the idea that it needed your code? Which brings me to the code.... |
Forum: C++ 12 Days Ago |
| Replies: 14 Views: 426 |
Forum: C++ 14 Days Ago |
| Replies: 7 Views: 275 And with everyone, you probably mean: no-one. Learn about indenting (http://en.wikipedia.org/wiki/Indent_style)code. Not to mention the use of clrscr(), void main(), conio, etc etc |
Forum: C++ 14 Days Ago |
| Replies: 12 Views: 15,139 Too many "give me da codezz" replies/bumps in this thread.
Closed |
Forum: C++ 15 Days Ago |
| Replies: 5 Views: 199 change #include <string.h> to : #include <string>
This should never have not compiled in G++, so that's strange.. |
Forum: C++ 16 Days Ago |
| Replies: 4 Views: 197 No you don't. That's the whole idea with namespaces: you don't just 'include' all the functions from it.
What if you have a second namespace (called mystd for example) which also has a cout... |
Forum: C++ 24 Days Ago |
| Replies: 5 Views: 215 So you haven't got a clue how to solve the problem, but you refuse to drop the course because you think you'll get some free points by cheating your way through it? I've heard enough, thread closed.... |
Forum: C++ 25 Days Ago |
| Replies: 7 Views: 397 this is wrong: mi = KM_MI * km;
"KM_MI" == km per mile. So if you already have km and want to go to miles, you should divide by this number, not multiply:
mi = km / KM_MI ;
Same error is in... |
Forum: C++ 32 Days Ago |
| Replies: 6 Views: 674 This may very well be the best post I have ever read on Daniweb. :icon_mrgreen: |
Forum: C++ 33 Days Ago |
| Replies: 13 Views: 16,180 Read post no. 11.
Thread closed due to multiple useless resurrections in the last 3 years. |
Forum: C++ 34 Days Ago |
| Replies: 14 Views: 502 I haven't posted any major projects here. But when I make project with > 100.000 lines for example, you can be sure that there are a few namespaces in it :)
Saying: "I haven't seen them here", "They... |
Forum: C++ 34 Days Ago |
| Replies: 14 Views: 502 Oh wow! Then I'll help you immediately:
#include <iostream>
int main(){
int number = 30;
std::cout << std::hex << number;
}
don't forget to put the credits in the codez! |
Forum: C++ 34 Days Ago |
| Replies: 14 Views: 502 This is slightly confusing. You say:
But you also say:
Why would you need the code, when you're making it yourself? And to make matters even more confusion, your signature says:
So why... |
Forum: C++ Nov 17th, 2009 |
| Replies: 1 Views: 269 It appears that your shift key is broken and your dot-key is stuck. You might want to consider buying a new keyboard.
Here's a 'getting started (http://www.daniweb.com/forums/thread63827.html)'... |
Forum: C++ Nov 12th, 2009 |
| Replies: 4 Views: 285 There are a few things wrong with your code:
int a = aa; . The compiler will complain about not knowing what 'aa' is. If you want to input hex-numbers, you need to add a 0x, so : int a = 0xaa; .
... |
Forum: C++ Oct 23rd, 2009 |
| Replies: 9 Views: 735 You shouldn't drink and drive and you should smoke and do math. That's how people come up with stuff like the Large Hadron Collider: very dangerous ;) |
Forum: C++ Oct 22nd, 2009 |
| Replies: 9 Views: 735 Also with B: this B = 3r + 12 + 10r + 20 = 102 //Distributive property is completely wrong. I have no idea what you're trying to do here.
Look, if r(B)=70/13=5.38... (according to you) then if you... |
Forum: C++ Oct 21st, 2009 |
| Replies: 3 Views: 343 You forgot to #include <sstream> |
Forum: C++ Oct 20th, 2009 |
| Replies: 9 Views: 253 If you compile with -Wall you should've seen the warning warning C4700: uninitialized local variable 'a' used and that's because class A doesn't have a constructor. (you commented it out) |
Forum: C++ Oct 19th, 2009 |
| Replies: 10 Views: 2,181 >>All I wanted just reduce the number of local variables.
>Yes, I see, though the algorithm of reversing the string is basically the same,
>I hadn't thought of the the fact that I could use... |
Forum: C++ Oct 15th, 2009 |
| Replies: 7 Views: 488 Or a real C++ solution:
#include <iostream>
#include <algorithm>
#include <string>
struct upper {
int operator() ( int c )
{ |
Forum: C++ Oct 15th, 2009 |
| Replies: 7 Views: 488 Remove that line again and put it inside your loop. Put a cout << c;
inside your loop and remove the other cin/cout statements.
So your loop-block should look like this:
{
c =... |
Forum: C++ Oct 8th, 2009 |
| Replies: 5 Views: 278 Put a std::cin.get() (C++) or : getchar() (C) right before the return 0; in main().
int main(){
// do stuff
std::cin.get();
return 0;
} |
Forum: C++ Sep 28th, 2009 |
| Replies: 1 Views: 372 (Answer) : Show some effort (http://www.daniweb.com/forums/announcement8-2.html) (in English Language) |
Forum: C++ Sep 24th, 2009 |
| Replies: 14 Views: 653 Here's how to do it:
int choices[2] = {2,3}; //choose between 2 and 3
// Seed the random generator with srand()
// Use rand() to pick either 0 or 1 and store in variable x
int L = choices[x];... |
Forum: C++ Sep 23rd, 2009 |
| Replies: 6 Views: 434 If your teacher taught you this, (s)he should be fired.
void main (http://www.gidnetwork.com/b-66.html)
clrscr (http://www.cplusplus.com/forum/articles/10515/)
And use cin.get() instead of... |
Forum: C++ Sep 17th, 2009 |
| Replies: 7 Views: 316 You're very close, but an even better way to do it is like this:
vector<int> vect;
/* Do stuff with vect */
vector<int>::iterator iter_max = max_element(vect.begin(), vect.end());
cout <<... |
Forum: C++ Sep 17th, 2009 |
| Replies: 5 Views: 233 You mean like the the link Salem posted in post #2? :icon_wink: |
Forum: C++ Sep 16th, 2009 |
| Replies: 5 Views: 408 First of all: read this about using code-tags (http://www.daniweb.com/forums/misc-explaincode.html)!! Then learn how to indent (http://en.wikipedia.org/wiki/Indent_style)your code.
There's a lot... |
Forum: C++ Sep 10th, 2009 |
| Replies: 8 Views: 366 |
Forum: C++ Sep 8th, 2009 |
| Replies: 11 Views: 564 You can't just wack a code here and expect people to explain it to you line by line.
I know you probably want to be a l33t game hacker, but this is not the way to learn C/C++.
Start here... |
Forum: C++ Sep 8th, 2009 |
| Replies: 10 Views: 1,376 First : DdoubleD was pointing out a flaw, he wasn't giving a suggestion.
Second: Why wouldn't this compile? |
Forum: C++ Sep 2nd, 2009 |
| Replies: 3 Views: 487 The line #include <windows.h> didn't ring a bell ? :icon_wink:
My personal favorite is wxWidgets (http://www.wxwidgets.org/) |
Forum: C++ Sep 1st, 2009 |
| Replies: 7 Views: 336 Perhaps you should learn C++ first, before you try replying to a thread. end1; != endl;, so your code won't compile. Also learn namespaces (http://www.cplusplus.com/doc/tutorial/namespaces/)and find... |
Forum: C++ Aug 27th, 2009 |
| Replies: 7 Views: 280 Call it with 2 variables as you've declared it, so change:
name(name2); to name(name1, name2); |
Forum: C++ Aug 27th, 2009 |
| Replies: 7 Views: 280 A correction on Adatapost's post:
This line: std::cout << a << " " << b;
should actually be : std::cout << a << " " << n;
A small typo :) |
Forum: C++ Aug 25th, 2009 |
| Replies: 5 Views: 342 Well you could, but it won't work. Position is undefined, and I've never heard of a member for vector that's called remove()
And even if you correct these errors, this line: if(v.size() <= 0)... |