Forum: C++ 13 Hours Ago |
| Replies: 5 Views: 90 You need a way to tell whether a string is a number or not. Define exactly what a "number" is (negatives, decimals, commas, just digits, etc.), then you can write a function to test a string. If... |
Forum: C++ 14 Hours Ago |
| Replies: 8 Views: 107 "Voila! Syntax-highlighting!" isn't part of the code tag. niek_e is just excited by the power of code tags and decided to spread the enthusiasm. Feel free to replace "Voila! Syntax-highlighting!"... |
Forum: DaniWeb Community Feedback 1 Day Ago |
| Replies: 8 Views: 136 Just tried to do a cut-and-paste of some C++ code. It renders fine on the forum page, but when you "Toggle Plain Text" to paste it into another document, you get some tags you don't want ('<strong... |
Forum: C++ 1 Day Ago |
| Replies: 14 Views: 270 You need to meet more C++ programmers then. Custom namespaces are all over the place, for good reason. I just debugged my own (very short) project. The culprit? I had several functions called... |
Forum: C++ 1 Day Ago |
| Replies: 11 Views: 172 You CAN "return" more than one value. "Return" is in quotes on purpose. Pass the row and column by reference (denoted by &).
int findMax(int grade[][20], int& row, int& column)
{
// same... |
Forum: C++ 1 Day Ago |
| Replies: 11 Views: 172 You should post your updated code and explain exactly what your present problem is. You've made a lot of revisions, but no one knows what they are. |
Forum: C++ 2 Days Ago |
| Replies: 2 Views: 102 Stringstreams will work wonders here. Let the >> and << operators do all the parsing and type changing work for you.
http://www.cplusplus.com/reference/iostream/stringstream/ |
Forum: Java 2 Days Ago |
| Replies: 7 Views: 221 Right now you don't have your Listener(s) set up to do anything. You need to either have:
One listener for both buttons. Within that listener, use getSource() to figure out which button... |
Forum: C++ 2 Days Ago |
| Replies: 25 Views: 732 He just gave you the entire program and now you want comments (very nice program by the way, sfuo. It works well). Why don't you go through the code, figure out how it works, and after you do,... |
Forum: Java 2 Days Ago |
| Replies: 7 Views: 221 Then you need another JTextField, unless you are using the same JTextField for both the answer and the question (which is fine). Right now you only have one JTextField. So decide where the input... |
Forum: C++ 2 Days Ago |
| Replies: 25 Views: 732 I'm looking at the post times. This one comes two posts after firstPerson's post. Quite fast. I wouldn't "get it" either if I had to learn the Insertion Sort in two minutes. Since it uses an... |
Forum: C++ 2 Days Ago |
| Replies: 25 Views: 732 "Simple", "efficient", "correct", and "not tedious" are different concepts. Your "easiest", most brain-dead method is to make 120 "if" statements, not taking advantage of the results of previous... |
Forum: Java 3 Days Ago |
| Replies: 7 Views: 221 Frame and Panel are Java classes. You may want to rename your classes to make it less confusing, or at least be careful and make sure you don't get them mixed up.
What do you want to have done... |
Forum: C++ 3 Days Ago |
| Replies: 25 Views: 732 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... |
Forum: C++ 4 Days Ago |
| Replies: 10 Views: 288 It seems to fluctuate between 0.03 and 0.08 seconds for me. I don't know enough about scheduling algorithms to know what would cause that fluctuation, or if that would be a factor in programs that... |
Forum: C++ 4 Days Ago |
| Replies: 10 Views: 288 Impossible to know without knowing what the code does and without knowing what else might be competing for your computer's resources while running the program, some of which might have a higher or... |
Forum: DaniWeb Community Feedback 4 Days Ago |
| Replies: 22 Views: 914 One person can't knock you 50 points on one post. However, one person CAN pick 50 random posts of yours from a year ago and downvote each of them as fast as he/she can click and as fast as the page... |
Forum: C++ 5 Days Ago |
| Replies: 2 Views: 164 You have number declared as an integer, but you are treating it as a string. There is no "int" class, so you cannot use the dot operator as you do in line 17. Use an if statement instead of the... |
Forum: C++ 5 Days Ago |
| Replies: 10 Views: 288 According to Ark M in this thread, if you want microseconds, you need something OS-specific.
http://www.daniweb.com/forums/thread134643.html
Ancient Dragon's idea in this thread is to do... |
Forum: Java 5 Days Ago |
| Replies: 4 Views: 213 I see nothing in the spec that requires any long-term non-volatile data storage. You enter the input every time you run the program. When the program is over, the input data is gone and the output... |
Forum: C++ 6 Days Ago |
| Replies: 2 Views: 134 There are two separate terms to think about: "size" and "capacity". "capacity" is the storage allotted to the array. "size" is the number of elements in the array THAT YOU CARE ABOUT. The main... |
Forum: C++ 6 Days Ago |
| Replies: 2 Views: 239 If you do not know the size ahead of time, you can use the MAXIMUM size to make sure you have now overflow. There is no maximum size for this. There's a maximum number of columns, but not a maximum... |
Forum: C++ 6 Days Ago |
| Replies: 1 Views: 115 It's a very common assignment, so if you google it, you'll probably find the code. But if you want help HERE, you need to show an attempt.
http://www.daniweb.com/forums/announcement8-2.html |
Forum: C++ 6 Days Ago |
| Replies: 3 Views: 163 Add this to your Header.cpp file:
List::~List()
{
}
or delete this line in Header.h: |
Forum: C++ 6 Days Ago |
| Replies: 4 Views: 244 Whatever the problem is, it's not niek_e's code, which should work whether one understands the code or not. Multi-cored lines flashing? niek_e's example is a console application. No lines,... |
Forum: DaniWeb Community Feedback 8 Days Ago |
| Replies: 53 Views: 1,840 You "had to" respond with vulgar language? Unless Bob has successfully placed a voodoo curse on you, he doesn't have the power to force your fingertips to type a bad word with the keyboard and click... |
Forum: C++ 8 Days Ago |
| Replies: 4 Views: 235 I wasn't thinking about flavors. I was thinking about the standard libraries listed here that are available to everyone and are portable:
http://www.cplusplus.com/reference/
I know of no... |
Forum: C++ 8 Days Ago |
| Replies: 3 Views: 224 You're hard coding too much here:
if ((y==0 || y==i-3) || y==i-1 || (x==0) || (x==i-1))
Your test needs to be whether y is even or not. Say the number of lines is 13. You want lines 0, 2,... |
Forum: DaniWeb Community Feedback 8 Days Ago |
| Replies: 53 Views: 1,840 Then you're a willing participant in all of this, just like Bob is. What are you complaining about? Seems like you're both trying to get under each other's skin, and Bob's been more successful, but... |
Forum: DaniWeb Community Feedback 8 Days Ago |
| Replies: 53 Views: 1,840 You can't delete your account, you can't delete your posts, you can't prevent Bob from posting, you can't control Bob's opinion, and you can't control Bob from PMing you. You CAN block Bob so... |
Forum: Java 9 Days Ago |
| Replies: 3 Views: 138 nextInt (int) requires a positive parameter. You are passing it arr[0], which is 0, which is an error. From the documentation:
... |
Forum: C++ 9 Days Ago |
| Replies: 4 Views: 235 Go through the word character by character and change each character to upper or lower case using toupper or tolower from cctype. There is no toupper or tolower function that takes a string as a... |
Forum: Java 9 Days Ago |
| Replies: 4 Views: 213 Yes, many here can solve it. But you need to show your attempt and ask a specific question. If you do, many people will be happy to help.
http://www.daniweb.com/forums/announcement9-2.html |
Forum: C++ 9 Days Ago |
| Replies: 3 Views: 224 Post what the figures should look like. Are we talking about this? And you can't get the last two?
Clear:
*****
* *
* *
* *
***** |
Forum: C++ 10 Days Ago |
| Replies: 8 Views: 298 Here's a skeleton that might help. It doesn't do any input validation and it doesn't correctly calculate the average. That will be up to you. But it gives a skeleton on how to pass the parameters.... |
Forum: C++ 10 Days Ago |
| Replies: 11 Views: 351 What's wrong with memcpy? If it's useful, use it. If not, don't. Resizing inevitably involves deep copies sometimes (sometimes not, depends on how you do it). Whenever you deep copy with a... |
Forum: Java 10 Days Ago |
| Replies: 4 Views: 209 One, your class is named Main3, not Main1, so make sure your html file points to the actual class file. I renamed the class to Main1 and compiled it. When I did, it created Main1.class, but it also... |
Forum: C++ 10 Days Ago |
| Replies: 1 Views: 116 Kind of hard to comment when you haven't posted what is stored where. I imagine that name, age, and address are stored in Person, and product is stored in Purchase. If I were to have Purchase... |
Forum: C++ 10 Days Ago |
| Replies: 11 Views: 351 Yeah, I'm treating the ssn, name, and hours as one object, so I'm thinking a 14 line file, each line containing those three items.
You'll either need clarification or you'll need to make some... |
Forum: C++ 10 Days Ago |
| Replies: 8 Views: 298 & signifies that the parameter is passed by reference, not passed by value. If this is a new concept to you, google "C++ pass by reference" and "C++ pass by value". Here's a link that explains and... |