- Strength to Increase Rep
- +17
- Strength to Decrease Rep
- -4
- Upvotes Received
- 759
- Posts with Upvotes
- 607
- Upvoting Members
- 264
- Downvotes Received
- 56
- Posts with Downvotes
- 52
- Downvoting Members
- 27
Spent most of my life in California. Santa Barbara is about as far south as I go. Right now I'm in Santa Rosa.Received a Bachelor's Degree in Math and Statistics, then became an actuary for a while. It was all right, but a little dull. Decided to try…
- Interests
- Soccer, Rock Climbing, Scuba Diving, Philosophy, World History, Writing and Literature
- PC Specs
- Dual Core Something or Other, Definitely not top of the line. I mainly tend towards AMD over Intel.…
2,827 Posted Topics
Re: Five numbers can be ordered 5! or 120 ways. The no-brainer way of writing this code would thus be writing an if statement with 119 "else if" statements, one for each possible ordering. You should be using <= instead of < (what if two elements are the same?). There may … | |
Re: What would f2f7 be, anyway? Is the smallest negative short in hexadecimal 8000 (corresponds to -2^15) and the largest negative short in hexadecimal ffff (corresponds to -1), so f2f7 is equal to: [code] f2f7 0d08 (flip bits) Add 1 0d09 Convert to decimal and add a minus sign -3337 in … | |
Re: The code is unreadable. Please format/indent it and use code tags. NetBeans and other IDEs will format the code for you if you want. Code tags are used as follows. All indentation is stripped out if code tags are not used. Please repost with them. [noparse] [code=JAVA] // paste code … | |
Re: > "Write a program that reads in ten numbers to an array. The program then reads the array and displays distinct numbers (i.e. if a number appears multiple times, it is displayed only once)" > > for example: > > `1 2 3 4 5 5 6 7 8 8 … | |
Re: [QUOTE=kittycat07us;785518]Hi, I'm having trouble with creating a program to split a number into there own separate digits and then multiplying the digits to create another number. The program will repeat itself until there is just one digit.. The main thing I'm having problem with is figuring out how I could … | |
Re: [QUOTE=computer engW;614105]Could any one answer my questions??[/QUOTE] I can't figure out what the questions are. The code you posted draws a triangle. Change it slightly to draw a square: [code=cplusplus] int main() { int n = 4; int line, loop; for (line = 1; line <= n; line++) { for … | |
Re: [QUOTE=Climber Ty;] For some reason it automatically shows all the nodes. Maybe I haven't totally grasped the concept of traversing, because I am thinking it will only show one at a time and I know my code isn't exactly right.[/quote] Well, what do you WANT the "traverse" function to do? … | |
Re: [QUOTE=brettw02;538790]Ok this is great... I am only unsure of one thing here --» I am a little unsure of the reason for [number - 1] -- Im sure im just overlooking something rather simple...[/QUOTE] The 1 is subtracted because in C++ array indexes start at 0 and your loops: [code=C++] … | |
Re: > All IP addresses used to register and ***post*** They all make sense to me except for keeping track of the IP address for every single post. Why would provng you aren't spamming require that you keep track of the IP from every single post? I have thousands of them. … | |
Re: [QUOTE=hollywoood69;984746]So i have been at this program for hours....and still no luck. I have made the changes that were suggested...but i get an answer of inf.....not sure what to do from here. any help[/QUOTE] [code=cplusplus] double mortgagePayment::tPayment(double principle, double term, double interest) { term = 0; int years = term … | |
Re: [QUOTE=Compton11;569810]Brittany, you can't do cin >> number[i]..That will not read a value and store it in the array...Do something like this: ...Remember to add to my reputation! [code] cin >> num; numbers[i] = num; [/code] [/QUOTE] [code] cin >> numbers[i]; [/code] works fine. The way you did it works too, … | |
Re: Trying to program a snake game if you can't make yourself understand classes is a recipe for disaster. Ditto linked lists and binary trees. There's a natural progression in C++: "Hello World", print your name, count to 10, count to however high the user wants, functions, arrays, pass-by-reference-versus-value, pointers, structures, … | |
Re: [QUOTE=samsons17;1038634]does anyone know how to do the program that are more or less like peteranswers?? This is the website which has been using to trick people... [URL="http://www.peteranswers.com/"]http://www.peteranswers.com/[/URL] and this is the secret : [URL="http://chriswondra.com/2007/02/21/peter-answers-the-secret/"]http://chriswondra.com/2007/02/21/peter-answers-the-secret/[/URL] i'm just wondering if i'm capable to do just a simple program that is similar like … | |
Re: That gets rid of the compile error by expanding the scope of monkey but that doesn't solve the real problem, which is that the OP should not have been using monkey on lines 116 and 150 in his original post in the first place. monkey is being used as a … | |
Re: That works, though it doesn't match what Ancient Dragon had in mind. His idea has the menu function also asking for the choice from the user. You could have a function that just displays it or one like his that asks for the choice as well. If you want to … | |
Re: [QUOTE=payara111;865657]How can i print it recursively with one helper function? [img]http://img2.imageshack.us/img2/1690/recursive.th.jpg[/img] Here, n will always be a power of 2 and c will be indicating the column number from which to start the output. The above pattern has been produced with the initial function call RecursivePattern(8,1) It prototype should be … | |
Re: To the OP, How can responding to help in such a way (and it WAS help, it wasn't trolling) possibly get you closer to the answer, which presumably is what you are looking for? There are twenty million ways of writing any program. HOW you write it depends on WHAT … | |
Re: Not sure what the question is, but presumably if the code above is in a function called: [code] int checkWinner() [/code] you would harness the return value like this: [code] int returnValue = checkWinner(); if(returnValue == 79) { // code for when O wins } else if(returnValue == 88) { … | |
Re: [QUOTE=playst205;614157]Thanks for the help ill see if it helps and ill contact you if it dusnt when ur online ANYONE ELSE READING THIS FEEL FREE TO GIVE ME YOUR RESPONSES FROM YOUR OPINION THANks[/QUOTE] As others have said, the error is clear, though it can be time-consuming to track down. … | |
Re: You could certainly write a C++ program that could send the following output to stdout: [code] <html> <body>Hello World</body> </html> [/code] but I imagine you'd have to stick it in the cgi-bin folder and type [url]http://somesite/cgi-bin/helloword.cgi[/url] in the browser. If you stick it in the html folder and try to … | |
I have a Yahoo website that uses phpMyAdmin. I've been given the directive "Please run the script mysql_fix_privilege_tables that should be included in your MySQL server distribution to solve this problem!" I do not know how to run this script (or any script) through phpMyAdmin. I've been looking online and … | |
Re: You need a nested loop. The trick in these(always) is to figure out what the loop counter boundaries are. [code] int i, j; for(i = ?; i < ?; i++) { for(j = ?; j < ?; j++) { cout << " "; } for(j = ?; j < ?; … | |
Re: [QUOTE=mattybennett;660320]Simple - because I must. I have been designing the application in question on paper (process and maths side) but recognise that I am weak on programming. That doesn't mean that I should not attempt it.[/QUOTE] You're tackling a huge project without having the fundamentals. I'm not saying don't attempt … | |
OK, I have been experimenting around with GridBagLayout and I'm getting the hang of it. Things are looking the way I want them to on the INITIAL drawing of the GUI. However, when I RESIZE the JFrame to make it smaller vertically, at a certain point, the proportions get skewed. … | |
Re: Sounds like you might want to consider changing majors. If you don't think you have an aptitude for programming, I think that's going to cause problems graduating with a CS degree. There are some darn good coders out there who aren't that great at the algorithms, etc. that are also … | |
Re: [code=cplusplus] #include <iostream #include <iomanip> using namespace std; //function prototypes double patientcharges(int, double, double, double); //in- patient double patientCharges(double,double); //out-patient int main() { char patientTye; //I = in-patient; //O = out-patient; int days; //num days of hospital stay double roomRate; //Daily room rate double medication; // Total medication charges double … | |
Re: >> Untill here everything is working good with me Looks good here too. >> but on line 6 I got confused. What happened to line 5? And what do these numbers represent? What's in the queue or what's in the variables? >> I got[B] 4 5[/B] Again, "got" needs to … | |
Re: Correct way. double fallingDistance1() // no need for any parameters { double d=0.5*9.8*t*t; return d; } d = fallingDistance1(); // harness the return value The way you had it... double fallingDistance1(double d) // no need for any parameters { d=0.5*9.8*t*t; return d; } fallingDistance1(d); There's no point returning a value … | |
Re: >> it's almost working but it seems to be ignoring the first character of the second string. Throw more stuff at it till you can verify this. Scramble the word "computer" and see if it always misses the same letter(s). Instead of "computer", use strings like "abcdefghij" and "jihgfedcba" until … | |
Re: Looks like good old-fashioned round-off and/or overflow error. I changed things to integer types and got rid of the pow, ceil, and abs calls and they match. [code] /********************************************************** Diffie–Hellman key exchange algorithm ------------------------------------- This program demonstrates the Diffie-Hellman exchange key algorithm Tips to improve security ------------------------- [1] Pseudo random … | |
Re: The code is fine. Your compiler installation is probably broken. You have a bad include path, permissions problems, or you have files missing. | |
Re: [quote] Also, i get that i = 3; i <= num; i++ would be true[/quote] I don't think it's true or false. It doesn't make sense. It's a loop, not a logical evaluation that evaluates to true or false. The evaluation part is the "i <= num" part. That's true … | |
Re: You can't cast a string to a char, which is what you are trying to do in line 25. That's where the error is coming from. Also, your line: [code] RandNum = 65 + rand()% 26; // generate the numbers in the ASCII range [/code] is assigning a value from … | |
Re: >> Sorry if this is the wrong place, it's an odd question so couldn't think where else! Networking forum? Not sure. Maybe you should flag your own post as a bad post and ask the mods to move it to wherever they think appropriate. >> So I'm looking for a … | |
Re: Drawing it how? Is this a console application or a GUI application? You haven't posted any code, so it's hard top know how to help. I know next to nothing about xemacs but if you aren't sure how to work it, you can always switch editors and do a copy … | |
Re: [QUOTE=ScienceNerd;960362]Thanks for the reply but I need make a program using the loop to give me that answer xD[/QUOTE] Well if you wanted to, you could just brute-force it. There are only three letters and hence 10 * 9 * 8 possibilities: [code] for (int g = 0; g < … | |
Re: A few things. One, as StuXYZ mentions, an interesting and refreshing problem. Two, there are definitely several ways to do this. As the link you cite mentions, after a while, the numbers of partitions and the length of the partitions themselves get pretty big, so you have both efficiency and … | |
Re: It has nothing to do with your sort. You have nothing TO sort. You need to create a loop and read an element at a time into your array, THEN sort it. | |
Re: You pose the question "What was the most trouble you have ever gotten in?", then you answer that with an an anecdote from your own life where you got in NO trouble at all. It's also unclear how exactly you could have gotten in trouble by scaring people about a … | |
Re: [QUOTE=preet4fun;696181]The manager of a football stadium wants you to write a program that calculates the total ticket sales after each game. There are four types of tickets--box, sideline, premium, and general admission. After each game, data is stored in a file in the following form: ticketPrice numberOfTicketsSold ... Sample data … | |
Re: Who wrote the spec? Who wrote the code? The code does not seem to have anything to do with the problem. I see no reason to have the word "double" in this code. Where would you need a non-integral date type? Line 92 - I see a 2 dimensional array … | |
Re: I'd probably have an integer function called: [code=cplusplus] int PlayerHasWinningMove (int board[]); [/code] This function would test to see whether any move by the human opponent could win the game. It would return some number that is not 0 through 8 (i.e. -1) if there was no winning move that … | |
Re: > The program runs perfectly but only reads in the 1st number. This is the output I get(I added the bold to stand out in this post): The program does NOT run perfectly. If it did, the output would be right and you would not be posting. As far as … | |
Re: These are two recent threads with similar topics. They're from the C++ forum, but the logic is the same in C. [url]http://www.daniweb.com/forums/thread111048.html[/url] [url]http://www.daniweb.com/forums/thread110846.html[/url] | |
Re: The worst sin is inconsistent indentation. A close second is no indentation at all. Coming in third is indentation of more than about 5 spaces. A close fourth is mixing tabs and spaces. Just use spaces. It needs to line up so people can tell where one bracket starts and … | |
I have developed a program for a word game that reads from a text file containing a list of all legal English words, then stores those words in an array used by other parts of the program. The program works, but I am not very happy with the word list … | |
Re: Some questions are timeless. I personally don't mind a thread bump of a solved problem if the poster bumping has something valuable to add. "Valuable" is subjective of course, but that is true of all posts. The pop-up saying that this is an old or solved thread is a good … | |
Re: Line 18 -- get rid of the asterisk in the filename. Line 29 - The escape character is '', not '/'. Line 29 - Don't forget the first parameter. Just make it a big number like 256. inFile.ignore(256, '\n'); That should solve most of your problems. You still potentially have … | |
Re: Chronic pain that lasts years is the one that really tests you, particularly one where your body is permenantly damaged and the pain comes from that, with no chance of ever getting better. You have the pain to deal with and you need to come to terms with the fact … | |
Re: Might want to use something besides gets. From cplusplus.com gets page http://www.cplusplus.com/reference/cstdio/gets/?kw=gets > The most recent revision of the C standard (2011) has definitively removed this function from its specification. > The function is deprecated in C++ (as of 2011 standard, which follows C99+TC3). As far as distinguishing end of … |
The End.