Forum: C++ 2 Days Ago |
| Replies: 7 Views: 192 Despite working as a programmer for several years, I wouldn't consider myself an expert per se. I'm still learning new things every day. But I'd have to echo what niek_e said and say that the main... |
Forum: C++ 3 Days Ago |
| Replies: 3 Views: 118 Your GetData and GetSize functions need to be declared const
e.g.
unsigned GetSize() const // This
{
return n;
} |
Forum: C++ 25 Days Ago |
| Replies: 7 Views: 266 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++ 27 Days Ago |
| Replies: 5 Views: 370 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++ 27 Days Ago |
| Replies: 5 Views: 370 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: C++ 31 Days Ago |
| Replies: 11 Views: 363 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++ 33 Days Ago |
| Replies: 4 Views: 309 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++ 33 Days Ago |
| Replies: 4 Views: 309 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++ Oct 29th, 2009 |
| Replies: 7 Views: 260 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++ Oct 16th, 2009 |
| Replies: 7 Views: 403 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: C++ Oct 9th, 2009 |
| Replies: 18 Views: 986 OK, push_back definitely is the safest way of populating a vector. However, the method I'm about to show is not particularly good practice, but it can be done and it does have it's uses:
... |
Forum: C++ Oct 9th, 2009 |
| Replies: 4 Views: 348 Why don't you try using the shlobj.h function SHGetSpecialFolderPath to get the path to the users My Documents folder? It would save all of the messing about your doing there!
Try replacing the... |
Forum: C++ Oct 7th, 2009 |
| Replies: 20 Views: 448 To put dkalitas point a little more succinctly:
If you want to execute several statements under an if() statement, then you should enclose them with curly braces '{}'.
e.g.
if(condition)
{
... |
Forum: C++ Sep 16th, 2009 |
| Replies: 5 Views: 386 Considering the problem you have set, your algorithm is completely wrong. And as already mentioned by niek_e, you're using the for loop incorrectly too!
Follow niek_e's advice and take a good look... |
Forum: C++ Sep 14th, 2009 |
| Replies: 4 Views: 201 In main() you aren't instantiating your matrix class correctly.
Also your add and multiply functions are currently member functions so you'd have to access them via an instance of your Matrix... |
Forum: C++ Aug 19th, 2009 |
| Replies: 10 Views: 442 What about if you change px from int to long? Does that give you any differemt results?
The thing to take note of here is that px is currently declared as an int. Whereas rect.right and rect.left... |
Forum: C++ Aug 7th, 2009 |
| Replies: 4 Views: 303 One other thing has sprung to mind....
If your program is actually running for a while before it bombs out, it's almost certainly a bug in your code.
If it works on your machine and not any... |
Forum: C++ Jun 4th, 2009 |
| Replies: 4 Views: 401 I seem to recall having similar issues at my previous job, I had some software to maintain in VC6 which threw up several errors when I first tried to compile the source, despite having paths set up... |
Forum: C++ Apr 30th, 2009 |
| Replies: 2 Views: 275 Nice post sky, well explained...
But I noticed a very very minor mistake here....
3*26=78, not 76.
So the final value of x is:
x = 78+5-30
x= 83 - 30 = 53 (as reported by the OP!) |
Forum: C++ Jan 7th, 2009 |
| Replies: 1 Views: 419 I'm not sure exactly what you're asking when you say
"can you tell me which style below function is showing in C++"
But I can answer the question in the topic title
"what is going on in this... |