- Strength to Increase Rep
- +8
- Strength to Decrease Rep
- -2
- Upvotes Received
- 15
- Posts with Upvotes
- 13
- Upvoting Members
- 13
- Downvotes Received
- 2
- Posts with Downvotes
- 2
- Downvoting Members
- 2
Student
Re: Cookies and milk - I ordered a pizza but I'm too hungry to wait without eating :P | |
Re: I'd do it that way too, just I'd add a little if-else-abs() trick to handle n<0 (otherwise it would print -567 reversed as -7-6-5). something like [CODE=C++]if(n<0) { cout << "-" << abs(n%10); revprint(n/-10); } else { cout << n%10; revprint(n/10); }[/CODE] | |
Hi all there. Firstly I apologize if this is not a specific question (please do point it out if you find this unpolite). I don't have real problems so if you're not personally interested feel free to save your time and close this thread :) Anyway, I had to write … | |
Re: [QUOTE=Narue;725597]Or you can just turn in something that will shut your teacher up, like this: [code=cplusplus] #include <iostream> int main() { for ( int i = 0; i < 32; i++ ) { for ( int j = 0; j <= i; j++ ) std::cout.put ( ~i & j ? … | |
Re: It's not that difficult to implement one by yourself: [CODE=C++]double myfabs(double x) { if(x>=0) { return ***; } else { return ***; } }[/CODE] It should be easy for you to figure out what you have to return in each case ;-) | |
Re: > Is it child abuse to name your son Adolf Hitler? Definitely yes imo! | |
Re: If a function returns, say, an int, you can use a call to that function in every place you could have used an int. Examples: [code=c++]#include <iostream> int sumFunction(int a, int b) { return a + b; } int main() { int a = 5, b = 7, c = … | |
Re: [ICODE]getline(cin, line);[/ICODE] Shouldn't you take your line from the ifstream? What daviddoria meant with the add function is that you are every time rewriting the file instead of just adding lines. Also you are not closing anything. Edit: You declare [ICODE]ifstream a;[/ICODE] in main but you make no use of … | |
Re: Sounds like a subset generating problem to me. I did almost the same thing a while ago, try reading [URL="http://www.daniweb.com/forums/thread159859.html"]this[/URL]. Hope that helps. | |
Re: You could use [URL="http://www.cplusplus.com/reference/clibrary/cstdlib/atoi.html"]atoi[/URL] or write your own char-to-digit converter, like this: [code=c++]int char2int(char c) { switch(c) { case '0': { return 0; } case '1': { return 1; } // ... and so on } }[/code] You could also do it without the switch, but I'll let you figure … | |
Hi all there. Given the huge amount of blackjack/card games threads and me being personally interested in poker and other games, I was feeling like starting to play with a few useful (at least I hope so) classes for dealing (no pun intended :P) with card games. I started my … | |
Re: Check out [URL="http://www.daniweb.com/forums/post755264.html"]this[/URL], I hope it'll help :-) It's still work in progress though there are some changes made... | |
Re: No. We won't do your homework for you. Read the forum rules, post [b]your[/b] attempt and [b]then[/b] ask for help (specifically). Make sure you use code tags. | |
Re: [QUOTE=ninja_gs;758769] JUST LOOK AT NAURE 's ATTITUDE [COLOR="Red"]"I'm here to prove you wrong"[/COLOR] So All Ppl Just think of it [COLOR="Red"]s(he) is Not here To Motivate or Help s(he) is Here to Make you comment and prove you are Wrong.. [/COLOR][/QUOTE] Here: [quote=Plato on Gorgias]And what is my sort? you … | |
Re: Astonishing ignorance. Thanks for posting, I'm waiting to read Chapter 2 [quote]It looks like we will get to meet in his office when School starts again after the holiday. I am anxious to meet a person who is this uninformed and still holds a position of authority and learnedness over … | |
Re: Either that or [code=c++]for(int month = 0; month < numYears*12; month++) { std::cout << "Enter rainfall (in inches) for month " << (month%12) + 1 << " of year " << (month/12) + 1 << std::endl; // do what you want }[/code] This assuming I understood your question. Please read … | |
Re: 1. Are you allowed to use recursion? If so it's easy. 2. Please use [URL="http://www.daniweb.com/forums/misc-explaincode.html"]code tags[/URL] when posting code. | |
Re: Read [URL="http://www.daniweb.com/forums/announcement8-2.html"]this[/URL] closely. No one is going to post-fed you a solution to [b]your[/b] homework, so show some effort or prepare to be ignored. After all it's [b]your[/b] programming class, not ours. | |
Re: Maybe [URL="http://www.daniweb.com/forums/thread161832.html"]this thread[/URL] will help (it's still "work in progress" but may give you some ideas) Hope this helps. | |
Re: Change [ICODE]a[i]= tmp;[/ICODE] with [ICODE]a += tmp;[/ICODE]. | |
Re: I you would like to keep track of previous executions of your program I suggest you to write these informations in a file - you can't keep an array from one execution to another afaik Oo | |
[URL="http://www.castpuzzle.net/english/index.html"]castpuzzle.net[/URL] My brother just brought me one from Munchen and I went crazy about it :P This is mine: [URL="http://www.castpuzzle.net/english/castpuzzle/radix.html"]Cast Radix[/URL]. I found it to be a little more difficult than I thought at first (it's level 4) but I managed to take it apart and then assemble it again … | |
Re: [code=c++]string myFile("rawDictionary2"); int totalWords= wordCount(myFile);[/code] you are sending in a string, why do you want it to accept an ifstream? | |
Re: Also: why do you check i? Instead of [ICODE]if(i=='m' && 'male')[/ICODE] try [ICODE]if(s=="m" || s=="male")[/ICODE]. First correct your toLowerCase as AncientDragon suggested, then fix "minor" things like the one I pointed out to you (and others like double s input) | |
Re: State_Tax is expecting float, you are passing float*. Change [ICODE]*statetax = State_Tax(federaltax);[/ICODE] to [ICODE]*statetax = State_Tax(*federaltax);[/ICODE] | |
Re: From the link you posted: [quote]A naive algorithm for finding palindromes calculates all positions of an input array, and for each of those positions, calculates the length of the longest palindrome around that position.[/quote] That shouldn't be much difficult to implement, and [quote]For each position, this function may take an … | |
Re: A similar thing happened in Genova, Italy, during 27th G8 summing in 2001. A policeman shot dead a masked guy who was throwing him a fire extinguisher [URL="http://notimaz.blog.kataweb.it/files/photos/uncategorized/carlo4_1.jpg"](photo)[/URL]. You can see it in the act of assaulting the officer inside the car (from where he fired). There's still a really … | |
Re: [QUOTE=Salem;749893]> He also will undergo a psychiatric evaluation. Yup, faith is a mental illness - in all it's forms.[/QUOTE] Great, I completely agree. Lol for the rest of your post :-S | |
Re: Everlast - Love, War and the Ghost of Whitey Ford. A new entry in my collection - I really like it so far Next one in playlist is Ellen Allien & Apparat - Orchestra of Bubbles |