Forum: Python 18 Hours Ago |
| Replies: 1 Views: 106 Lets try to describe the problem better...
Is the problem:
a) search the directory for a file name
b) search a specific file for string data
c) search all of the files in a directory for... |
Forum: C++ 18 Hours Ago |
| Replies: 1 Views: 83 I'm presuming that x is the number of array entries you filled. A more descriptive name would be more appropriate.
line 15 in your code would be executed for every pass of the loop.
If the... |
Forum: C# 1 Day Ago |
| Replies: 25 Views: 427 For a multiple form interface, you will need to keep a list of all of the open forms and keep the list current when forms are closed or opened. You will also need a method to reference the 'current... |
Forum: C# 2 Days Ago |
| Replies: 25 Views: 427 Now we're getting into scope a bit (and its a big topic) but class-level variables only exist once, regardless of the number of instances of the class.
Based on your example, where you want... |
Forum: C# 2 Days Ago |
| Replies: 25 Views: 427 Yes that would be a valid example.
Another example would be a 'person' class. Each person has attributes: name, address, phone number, birthday, ...
But any two instances of 'person' are... |
Forum: C# 2 Days Ago |
| Replies: 25 Views: 427 I apparently wrote this while Ryshad was replying. He covers most of it in a more elegant fashion, but I'll post it anyway.
Local variables work like you mentioned your i did in VBA. If you... |
Forum: C++ 2 Days Ago |
| Replies: 4 Views: 153 Well, ignoring that your input doesn't do much to protect the user from themselves (for example, enter "fred" when it asks for the account number and see what happens)...
Do you know in advance... |
Forum: C Apr 21st, 2009 |
| Replies: 6 Views: 712 Not surprisingly, but your program is doing what you told it to:
// Wait here for the user to enter a message
gets (msg);
while (msg != "q")
{
/* Write out message. */
... |
Forum: Python Apr 9th, 2009 |
| Replies: 3 Views: 325 You're having an entity vs value comparison issue:
a = [[1,2],[2,0]]
b = [2,0]
aa = a[1]
# at this point, b = [2,0] and aa = [2,0]
# but aa == b returns False
# aa[0] == b[0] returns True |
Forum: Python Mar 9th, 2009 |
| Replies: 62 Views: 394,739 I was working on revamping the code...most of it would need changes to work with the classes. |
Forum: Python Mar 8th, 2009 |
| Replies: 62 Views: 394,739 Ok, I'm going to post this...I've started it several times and then you post a significant rewrite of your code and to help you I have to toss this stuff out.
You can use the idea and expand on... |
Forum: Python Mar 7th, 2009 |
| Replies: 62 Views: 394,739 If you're having a problem with part of the code, please be specific as to what the problem is. What did you see? What did you expect to see?
If it is a compile problem, include the full text of... |
Forum: Python Mar 4th, 2009 |
| Replies: 62 Views: 394,739 Just as a side note, you could make the game a lot easier (potentially faster too) if you would let the user select things by number.
For example when selecting "battle" "shop" or "exit" if the... |
Forum: Python Feb 28th, 2009 |
| Replies: 62 Views: 394,739 I would reset the player and monster health at the start of the battle.
The weapons would make a good class, the weapon has a name, a cost and an amount of damage. Then you could make a list of... |
Forum: C++ Feb 21st, 2009 |
| Replies: 6 Views: 805 If you don't intend to use any of the predefined C++ data types in your implementation, what do you propose to use?
A 6000 byte long number could be implemented, I would probably use an array with... |
Forum: Python Feb 7th, 2009 |
| Replies: 4 Views: 594 @starzstar
I think the module you're looking for it getopt
It is designed to parse command line arguments and handles the type you indicated.
@keerthihm
You should probably have started... |
Forum: C++ Jan 27th, 2009 |
| Replies: 1 Views: 253 Whether or not the source is available for a given library is up to the developer of the library.
If the source files are not included, you can't step into them. (Unless you like to read... |
Forum: C++ Jan 26th, 2009 |
| Replies: 1 Views: 331 I've always thought that the 'snake' collision detection just looked at the next square the snakes head was going to be put. If there's something in the square, its a collision. If its food, the... |
Forum: C++ Jan 25th, 2009 |
| Replies: 12 Views: 636 You already have a 'global' (ok so it is local to the class, but all of the class methods can see it) data area defined. See this section under private in your class:
private:
double average;... |
Forum: C Jan 22nd, 2009 |
| Replies: 11 Views: 741 Please don't answer each post since your last with the same string, we all have to read through all of them.
I can't imagine any phone system where you can pre-order sequential 7 digit phone... |
Forum: Python Jan 21st, 2009 |
| Replies: 4 Views: 930 On line 2, r is coming from the values in the dictionary, not the keys.
So you can't use it as a key on line 8, you can't index a dictionary by the definition.
You could either test to see if the... |
Forum: C++ Jan 20th, 2009 |
| Replies: 14 Views: 772 Once you 'know' what class it actually is, you can cast the pointer...
if (typeid(*pacct) == typeid(SavingsAccount)) {
SavingsAccount * pSave = (SavingsAccount *)pacct;
// or more... |
Forum: C++ Jan 20th, 2009 |
| Replies: 1 Views: 828 Note 1: Indenting is your friend, make much better use of him.
Note 2: if you're in your main() and you return, your program is done
I'm not sure what's up with the two-level menu, where you... |
Forum: C++ Jan 18th, 2009 |
| Replies: 26 Views: 1,116 I suspect your problem with multiple inheritance is actually a multiple-include problem.
If you put Freaky_Chris's example in one file, you have no problem.
If you put all 3 classes into... |
Forum: C++ Jan 17th, 2009 |
| Replies: 26 Views: 1,116 I suggested that children should never be a friend of their parent.
Parents should define anything the children should have access to in the protected: section.
I was also arguing that in this... |
Forum: C++ Jan 17th, 2009 |
| Replies: 6 Views: 429 And even that looks like something the instructor gave you. With the "do not modify" and "add code here" comments: |
Forum: C# Jan 10th, 2009 |
| Replies: 1 Views: 870 I think your only option is to change the color of the characters.
Take a look at this snippet (http://www.daniweb.com/code/snippet134.html)
If you set your 'default' color to grey or light... |
Forum: C Jan 10th, 2009 |
| Replies: 2 Views: 366 So 'list' is an index into the virtual heap, and each entry in the virtual heap is a structure that has an elem (the value at that node) and a next (the index in the virtual heap for the entry with... |
Forum: C Jan 9th, 2009 |
| Replies: 3 Views: 485 We are not, nor have we ever been a 'here is your completed assignment because you asked for it' source of information. Our basic premise is to help you fill the 'gaps' in your knowledge. We help you... |
Forum: Python Jan 8th, 2009 |
| Replies: 7 Views: 687 To do more with the color, you're probably going to want to look at the component parts of the tuple.
For example, the following would count any pixel with more green than red and more green than... |
Forum: C Dec 28th, 2008 |
| Replies: 9 Views: 536 Not to be picky, but #define NUMBERS is a pre-processor directive and doesn't get scope.
(But it should have been outside the function anyway.) |
Forum: C++ Dec 25th, 2008 |
| Replies: 16 Views: 1,445 Ok this will be a bit of code, but bear with me. The concepts came from the tutorial link from the earlier post and some test code I wrote to make sure I understood how it works. (I've never used a... |
Forum: C++ Dec 24th, 2008 |
| Replies: 17 Views: 993 ok, I did the default constructor and called resize(). The assert is gone and the program runs.
I also did a little more playing, I added a third player 'Bob' who is also a CPU (not that it really... |
Forum: C++ Dec 23rd, 2008 |
| Replies: 17 Views: 993 I took the zip file and made a MS project around it.
I had to add #include <algorithm> to hand.cpp but other than that it compiled.
I then uncommented your troublesome line:
void... |
Forum: Python Dec 23rd, 2008 |
| Replies: 3 Views: 1,751 The problem with using "A-" as a variable name is that it is illegal.
You can create a variable A_minus without any problem, but you don't want the user to be inputting your variable names anyway.... |
Forum: Python Dec 22nd, 2008 |
| Replies: 12 Views: 759 Please, when posting python code, use code=python tags
As I said in my previous messages, you needed to indent more lines to make them part of the loop.
house= ["computer", "laptop", "tv",... |
Forum: C Dec 19th, 2008 |
| Replies: 12 Views: 856 None of the characters ever "HAVE" to match anything.
The way it works is something like this:
Lets say we have a char * date that points to "01/12/2009" which is in memory as... |
Forum: C++ Dec 15th, 2008 |
| Replies: 4 Views: 957 As a note, I love using functions to help break things up. You have several things which would support that well.
1) The 'assignment' asks you to fill the board with pairs of numbers from 1-8. On... |
Forum: C++ Dec 14th, 2008 |
| Replies: 1 Views: 418 So you want the loop to keep running while the xPos is different or the yPos is different. You wrote while the xPos is different AND the yPos is different. The loop needs to run while either doesn't... |
Forum: C++ Dec 13th, 2008 |
| Replies: 42 Views: 2,000 If you're not going to use sortField, go ahead and remove it.
PS- ddanbe is right
In my sample program, the sort submenu looks like this:
sortExit = false;
... |