My VC++ compiler (Studio 6.0, service pack 3) is behaving oddly. It seems to not be compiling changes I make to a file. For instance, I might put a statement like this into a function:
cout << " * * * Testing this function * * *\n:"
It will compile fine, I'll debug the function...
I have this statement in a function:
cout << m << ", XSet ID# " << temp_xid;
m is a pointer to a string. temp_xid is an unsigned long. For some reason, an assertion failure is occurring inside cout every time I try to pass a numeric constant or variable. temp_xid, long, int, short...
The simplest way is to say:
char c = '9';
short int n = c - '0';
If 57 is the ASCII value of '9' and 48 is the ASCII value of '0', then n will be assigned 57 - 48, which is 9. This will work for any ASCII digit character.
RE: What's the point of returning a coordinate class? Because that way you can return two values, x and y, simultaneously. Otherwise, you would have to pass them by reference through the parameter list (keep in mind that a class is really just a struct).
Also, it is often conceptually easier to...
C was designed to program the unix operating system and to give maximum control to the programmer, so the programmer must check bounds on his/her own. C++ continues this tradition.
Pascal and BASIC were designed by university instructors to teach programming concepts, so they do many mundane...
Kudos to Matt (Zyrenthian) and Toby (LF28).
The problem can be solved in at least two ways, by putting #include "Example.cpp" in either the driver file or by putting it in the Example.h file after the class declaration.
I think putting it in the header is more reliable, but just to...
For the life of me, I can't figure out why this doesn't work. I've carefully double checked my work. Here's the problem:
I have a header file that looks something like this:
// Example.h //
#include <iostream>
using namespace std;
#ifndef Example_h
#define Example_h
template...
I have a header file with a class declared like so:
template <class Item> class ItemJArray { ... };
I want to typedef this in a source file, but this does not work:
typedef ItemJArray JArray;
I want JArray to behave exactly like ItemJArray. Specifically, I want to be able to...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.