Search:
Type: Posts; User: crei
Search:
Search took 0.02 seconds.
-
January 28th, 2010, 10:51 PM
You can use forward declarations and hide the object implementation behind a pointer.
So A.h would look like
class B;
class A{
public:
A(){}
-
February 12th, 2009, 10:56 PM
int a=5;
if (a==7||6||5||4||3||2)
is not going to do what you want it to (the condition will always be true). Instead do
if( a >= 2 && a <=7 )
// Do something
-
December 20th, 2007, 10:12 PM
Use cygwin. It contains most of the tools that you accustom to (vi, emacs, gcc, gdb, etc). It is basically a linux like environment that runs on a windows platform.
I think that this is...
-
December 20th, 2007, 05:13 PM
Just to answer my own question just incase anyone else faces this problem:
In gcc there are INFINITY and NAN defines in math.h. However you need to compile the source with gcc -std::c99. ...
-
December 19th, 2007, 06:29 PM
But this could vary from compiler to compiler. I need a function or macro. Also what about Nan?
-
December 19th, 2007, 05:41 PM
I was wondering what the equivalent to
numeric_limits<double>::infinity()
numeric_limits<double>::quiet_NaN()
numeric_limits<double>::signaling_NaN()
would be in C.
I have tried
-
Reading numbers in directly with cin is tricky. Just take in the ID as a string, then you can use the atoi function in cstdlib so you don't have to write the strToInt function. Here is the fix:
...
-
Iterate over the structure and output the contents. There are plently of examples of how to do this. In your case,
ostringstream ost;
........
std::vector<Person>::iterator iter =...
-
Sounds like you need to do some redesign. If you are writting these questions to disk you should format in someway, such as in XML format. For instance,
<Trivia>
<id>1</id>
...
-
Sounds to me like you should have a person class or struct that contains name and age members. You can then insert the objects into a vector if you like.
typedef struct Person {
std::string...
-
From what I can see I don't think that you need a queue class because the STL already contains collections which are prefect for RR Scheduling. If on the other hand you do need a class for queue,...
-
Init using the subclass. See main().
int main() {
Item *sofa = new Sofa();
sofa->printDetails();
delete sofa;
return 0;
-
You should probably create a class that defines a category, then create and add them to some sort of collection. Here is an example using a vector. It is trivial to have main() create the Category...
|
Click Here to Expand Forum to Full Width
|