Forum: C++ 6 Hours Ago |
| Replies: 7 Views: 67 |
Forum: C++ 6 Hours Ago |
| Replies: 7 Views: 67 Oh I see you've HAD to implement your own queue class as a part of your assignment...sorry I thought you were just over complicating things for yourself.
In that case, to turn your class into a... |
Forum: C++ 7 Hours Ago |
| Replies: 7 Views: 93 dkalita has already explained it to you...Try reading his post again!
The function 'fun' returns an int.
But it takes a pointer to a function as a parameter.
The function pointer must point to a... |
Forum: C++ 9 Hours Ago |
| Replies: 7 Views: 67 It seems to me that you are over complicating things. Wouldn't it be a lot simpler to just use a double ended queue, otherwise known as a deque?
Modifying your code from one of your previous posts... |
Forum: C++ 1 Day Ago |
| Replies: 1 Views: 110 The thing that's confusing me is how you're getting a syntax error from a data-file!!
How are you running the program and passing the parameters? Are you running it from the command line? or from... |
Forum: C++ 1 Day Ago |
| Replies: 4 Views: 80 Yup, as suspected; logical AND is evaluated left to right, so if the 1st condition fails / is false, then the 2nd condition is ignored and the logical AND operation returns false. The 2nd condition... |
Forum: C++ 1 Day Ago |
| Replies: 4 Views: 80 If memory serves, if the left hand condition fails it won't bother evaluating the right hand one.
(depending on how the AND is evaluated...I think it gets evaluated left to right, so I'm pretty... |
Forum: C++ 1 Day Ago |
| Replies: 4 Views: 80 This would be the simplest way of doing it:
Point* MyPoint = Object->GetMyPoint();
if(MyPoint && MyPoint->GetValue() != 2)
do A;
else
do B;
Cheers for now, |
Forum: C++ 2 Days Ago |
| Replies: 8 Views: 159 You might want to take a look at this thread:
http://www.daniweb.com/forums/thread230230.html
The first few posts are irrelevant, but the later posts are probably more or less exactly what you're... |
Forum: C++ 2 Days Ago |
| Replies: 1 Views: 83 It's because the literal value (25.95) that you are passing into your call to the function VAR1 is automatically treated as a double, but your function takes a float as a parameter. So you're getting... |
Forum: C++ 2 Days Ago |
| Replies: 5 Views: 161 Aha,
I've just fired up one of my linux boxes, I've created a project in codeblocks using your files. I've made my suggested changes and and tried compiling... And there are still compiler errors.... |
Forum: C++ 2 Days Ago |
| Replies: 5 Views: 161 One thing that immediately strikes me is that you are using #pragma once, which as far as I am aware is a preprocessor command that is used solely by Microsoft compilers. So perhaps using traditional... |
Forum: Geeks' Lounge 5 Days Ago |
| Replies: 13 Views: 307 Seeing as I'm paying for 2Meg broadband, I think I'm being ripped off!
494kbps down
227 kbps up
Pretty slow! |
Forum: C++ 5 Days Ago |
| Replies: 11 Views: 268 No worries, glad to help!
So, problem solved??
Cheers for now,
Jas. |
Forum: Geeks' Lounge 5 Days Ago |
| Replies: 11 Views: 485 Being a filthy, foul, potty mouthed pirate, my life was rated Arrrrrrrrrrrrr!
Heh heh....Sorry, R!
I agree with the previous posters. That was a bit of a crap quiz! |
Forum: C++ 5 Days Ago |
| Replies: 11 Views: 268 Here's your original project back, I've included my edits in there.
See attached .zip.
Cheers for now,
Jas. |
Forum: C++ 5 Days Ago |
| Replies: 11 Views: 268 Ah...Of course!
The parameter to your copy constructor should be const..
e.g.
BaseEnt(const BaseEnt &other);
Also you need to alter the signatures of GetName, GetHashCode and GetID so... |
Forum: C++ 5 Days Ago |
| Replies: 11 Views: 268 I haven't got VS2008, so I can't load the original project. However, I've bunged the files into a VS2003 project and attempted to compile.
I can see the errors you're getting and I've noticed... |
Forum: C++ 5 Days Ago |
| Replies: 11 Views: 268 OK, so looking at your original post again, you said that clicking on the error brought you to this line of code:
extern std::vector<BaseEnt> entities;
This code looks like it's from another file... |
Forum: C++ 6 Days Ago |
| Replies: 11 Views: 268 Hey Tom.
Looking at the error messages and the fact that some of them are referring to a vector and then looking at line 3 of your final block of code:
std::vector<BaseEnt> entities(;
Note:... |
Forum: C++ 8 Days Ago |
| Replies: 4 Views: 190 OK well, to clear things up we'll take a quick look at how different parameter passing methods affect the way that parameters to functions are handled inside functions.
There are three main ways... |
Forum: C++ 8 Days Ago |
| Replies: 4 Views: 190 OK, I'm not sure exactly what you're after here but this snippet might help you a little:
#include<iostream>
#include<fstream>
#include<string>
#include<vector>
using namespace std;
... |
Forum: C++ 12 Days Ago |
| Replies: 5 Views: 175 Alternatively, if you only wanted the extra block to be shown if the value of the parameter was 3 then you could change this block from my previous listing:
if(i==myCondition)
{
cout << "i = "... |
Forum: C++ 12 Days Ago |
| Replies: 5 Views: 175 Then what you need to do is parse the command line and store the relevant arguments in variables and then use those variables to determine what happens in your code.
So perhaps something like... |
Forum: Graphics and Multimedia 13 Days Ago |
| Replies: 2 Views: 399 Hmm, I used to work with flash components from time to time at my previous job, (both creating and customising components) but those were all AS1 and AS2 components. And although I work pretty much... |
Forum: C++ 13 Days Ago |
| Replies: 7 Views: 213 Aha, I've just quickly tested it and it seems to work!
Here's a little program I knocked up, loosely based around previously posted code in this thread:
#include <iostream>
#include <algorithm>... |
Forum: C++ 13 Days Ago |
| Replies: 7 Views: 213 I've not actually tried this, but would something like this work for the deq_test function?
bool deq_test(Str& deq1, Str& deq2)
{
if(deq1.a==deq2.a)
{
return(deq1.b<deq2.b);
}
else |
Forum: C++ 13 Days Ago |
| Replies: 6 Views: 213 Ok, well for starters what you're seeing in Notepad isn't any kind of script, it's actually machine code but rendered in notepad as ascii text. But if you view the .exe with a Hex editor, then things... |
Forum: Graphics and Multimedia 16 Days Ago |
| Replies: 15 Views: 1,049 Morning all!
Apologies for the lack of activity recently, I've been out of action for a week or so thanks to a rather severe case of sinusitis...I initially made the mistake of ignoring it, hoping... |
Forum: C++ 26 Days Ago |
| Replies: 7 Views: 350 Hey there!
Don't forget to look at the replies in your other thread where you've already asked about this!
http://www.daniweb.com/forums/thread230230.html
After you got an answer to your... |
Forum: C++ 26 Days Ago |
| Replies: 7 Views: 331 Another thing that was pointed out by one of my math-geek colleagues was that my algorithm would also incorrectly flag 1 as prime.
Now I always thought that 1 was prime (it only divides evenly by... |
Forum: Python 27 Days Ago |
| Replies: 4 Views: 203 Do you mean something like this??
numarray = [1,2,-3,4,5,-25]
for n in numarray:
print "The inverse of", num, "is", num * -1
#print("The inverse of", num, "is", num*-1)
# use the... |
Forum: Graphics and Multimedia 27 Days Ago |
| Replies: 15 Views: 1,049 Hey Iamthwee,
re: the font issues...
Do you want me to take a look?
I should be able to work out how to change the font. If the .fla file is in CS3 format, I should have no probs doing it... |
Forum: C++ 27 Days Ago |
| Replies: 7 Views: 331 Hey Gaiety!
Good point, the original code was just quickly bashed out, off the top of my head and yes I missed 2 out!..
OK, so if the passed in number is 2 we need to return true (Prime),... |
Forum: C++ 27 Days Ago |
| Replies: 7 Views: 331 For starters; in your code just above you need to use the == (equality) operator to test for equality, not the = (assignment) operator.
Also, that is definitely not the correct formula for... |
Forum: C++ 28 Days Ago |
| Replies: 7 Views: 331 All you need to do is use the modulus operator %.
So check the value of posnum % 2
What this does is it divides posnum by 2 and returns the remainder.
Here's a brief look at what is returned.
1 %... |
Forum: C++ 28 Days Ago |
| Replies: 3 Views: 188 Your dynamic_cast is fine, but take another look at your code..You've iterated through the list and printed all items, then you've printed a message saying that you're going to print only the... |
Forum: C++ 28 Days Ago |
| Replies: 4 Views: 169 Doh, the dragon got in there while I was composing my rambling post! heh heh! :) |
Forum: C++ 28 Days Ago |
| Replies: 4 Views: 169 Your problem is with the way you're using the vector with the push_back function.
push_back is used to put an item onto the back of the vector, but you can't say at item[i] in the vector push a... |
Forum: C++ 28 Days Ago |
| Replies: 2 Views: 243 ok, well for starters, the reason your call to mysin2 is working is because you are passing in myfunc, it doesn't matter that you haven't passed a strict function pointer, it gets treated as a... |