Forum: C++ 12 Days Ago |
| Replies: 1 Views: 208 There's MySQL, there's C++, and there's how to use MySQL from C++. I've used MySQL++ as a wrapper successfully to do this, but that was a while ago, so I don't remember the ins and outs. The first... |
Forum: Java Nov 18th, 2009 |
| Replies: 7 Views: 681 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++ Nov 18th, 2009 |
| Replies: 25 Views: 1,706 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 Nov 18th, 2009 |
| Replies: 7 Views: 681 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++ Nov 18th, 2009 |
| Replies: 25 Views: 1,706 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++ Nov 18th, 2009 |
| Replies: 25 Views: 1,706 "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 Nov 18th, 2009 |
| Replies: 7 Views: 681 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++ Nov 17th, 2009 |
| Replies: 25 Views: 1,706 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: Java Nov 15th, 2009 |
| Replies: 4 Views: 338 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++ Nov 14th, 2009 |
| Replies: 3 Views: 406 Add this to your Header.cpp file:
List::~List()
{
}
or delete this line in Header.h: |
Forum: Java Nov 11th, 2009 |
| Replies: 4 Views: 338 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++ Nov 10th, 2009 |
| Replies: 8 Views: 418 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: Java Nov 10th, 2009 |
| Replies: 4 Views: 302 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++ Nov 10th, 2009 |
| Replies: 8 Views: 418 & 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... |
Forum: Java Nov 10th, 2009 |
| Replies: 4 Views: 302 Looks fine to me. You need to get the error message. Does it work when you run it on a local machine? Try putting Main2.class and the html page in the same folder on your local hard drive and... |
Forum: C++ Nov 10th, 2009 |
| Replies: 8 Views: 418 Please use code tags.
// code here
void getScore(double s1, double s2, double s3, double s4, double s5); |
Forum: C++ Nov 9th, 2009 |
| Replies: 9 Views: 368 I don't get that error. I get a conversion warning that went away when I did this:
int t = (int) (ceil(sqrt(num)));
http://www.cplusplus.com/reference/clibrary/cmath/sqrt/
It might... |
Forum: C++ Nov 9th, 2009 |
| Replies: 9 Views: 368 The formatting/indentation makes this code very hard to read. Compare with this:
#include<iostream>
#include<fstream>
#include<iomanip>
#include<string>
#include<cmath>
using namespace std; |
Forum: C++ Nov 9th, 2009 |
| Replies: 9 Views: 368 The formatting/indentation makes this code very hard to read. Compare with this:
#include<iostream>
#include<fstream>
#include<iomanip>
#include<string>
#include<cmath>
using namespace std; |
Forum: C++ Nov 8th, 2009 |
| Replies: 5 Views: 456 You're printing a bunch of spaces, then an endline. Don't do that. It's pointless to have the last character in a line be a space.
Here's what you need to do:
Display a certain number of... |
Forum: C++ Nov 8th, 2009 |
| Replies: 9 Views: 368 Mathematically, any non-prime number will have a factor less than or equal to its square root. That means that if you have established that a number has no factor less than or equal to its square... |
Forum: Geeks' Lounge Nov 7th, 2009 |
| Replies: 12 Views: 1,085 Why would you start a thread in the Geek's Lounge and then say this? I mean what's the point of starting a thread if you don't want other peoples' opinions? |
Forum: C++ Nov 5th, 2009 |
| Replies: 8 Views: 381 If you read it in as a c-style string, you can use getline and specify 6 characters (5 + 1) maximum. Or use get () five times.
http://www.cplusplus.com/reference/iostream/istream/getline/
... |
Forum: C++ Nov 3rd, 2009 |
| Replies: 13 Views: 535 If you can get it to work without a function, it's a matter of converting that code so that it's inside of a function. Post the code that works where it's all in main. |
Forum: C++ Nov 3rd, 2009 |
| Replies: 17 Views: 501 That's what "return" does. It takes you back to main, to the place right after where you called the medic function, which puts you back in the main function. So if the person enters 2 in the medic... |
Forum: C++ Nov 3rd, 2009 |
| Replies: 17 Views: 501 Do NOT call the main() function. If you want to repeat, your program should look something like this (starting at line 61):
do
{
// display user's options
// ask user to input option.
... |
Forum: C++ Nov 3rd, 2009 |
| Replies: 17 Views: 501 Lines 20, 88. Arrays already are passed by reference. Get rid of the ampersand:
void medic(int & money, int & potionsize[5]);
Delete the ampersand in red above on line 20 and on line 88.... |
Forum: C++ Nov 2nd, 2009 |
| Replies: 4 Views: 319 // outline
// #include statements here
// #define statements here
// global variables here
// function declarations here
int main (int argc, char* argv[])
{ |
Forum: C++ Nov 2nd, 2009 |
| Replies: 6 Views: 494 Looks good to me. Try it out. Does it work? |
Forum: C++ Nov 2nd, 2009 |
| Replies: 6 Views: 494 #include <iostream>
using namespace std;
int main()
{
int TESTS = 0;
int testScore[TESTS];
int testNum = 0;
int a;
double total = 0; |
Forum: C++ Oct 31st, 2009 |
| Replies: 13 Views: 535 You're simply merging two files that are ALREADY in order into one output file. Hence only very minimal storage is required (one value from each input file), so vectors are overkill. Have two... |
Forum: C++ Oct 30th, 2009 |
| Replies: 10 Views: 849 That's what I don't understand. Seeding seems necessary to me here. Isn't it necessary to seed the random number generator if you want good results? |
Forum: C++ Oct 30th, 2009 |
| Replies: 10 Views: 849 I'm intrigued. Why would you consider not seeding the RNG here? |
Forum: C++ Oct 28th, 2009 |
| Replies: 5 Views: 459 This is what I've been harping on since the major change-over at Daniweb. Java code is now flagged as C++ code instead of plain-old code if you don't specify Java-specific code tags. It... |
Forum: C++ Oct 23rd, 2009 |
| Replies: 4 Views: 384 Garbage in, garbage out. Before you spend a lot of time analyzing your functions to see where the logic error is in calculating the lowest, highest, and average, loop through your array and make... |
Forum: C++ Oct 23rd, 2009 |
| Replies: 4 Views: 516 Lines 14 and 16 - get rid of the semicolons. With the semicolons there, there is no loop.
Line 15 - it would be an error with the semicolons above, but after you take them out, notice that you... |
Forum: C++ Oct 21st, 2009 |
| Replies: 12 Views: 504 while (N>1 && i>=0)
{ fact = fact * (N-i);
i = i+1;
}
Yes, i changes, but not in a way that will get you out of this loop. N doesn't change, so this is an infinite loop. Once... |
Forum: C++ Oct 20th, 2009 |
| Replies: 3 Views: 249 Line 33 - number is not initialized and you are using number to initialize nuCoins, so you are initializing nuCoins, but you have no idea what you're initializing it to since number is not... |
Forum: C++ Oct 18th, 2009 |
| Replies: 4 Views: 263 I can't analyze the code you attached since it's in a language I don't know. But here's an example of a very simple encoding technique that simply pads to "encrypt" (not really encryption), and... |
Forum: C++ Oct 17th, 2009 |
| Replies: 5 Views: 397 infile >> value;
while (!infile.eof())
{
outfile << value;
outfile << endl;
infile >> value;
} |