Need help C + +: an object that refers to? [syntax error] [gt 5]
Q: Im trying the length of a song to make sure it is not 5 or vindenu003e u003c3. I tried
unsigned int * = ptrIDNumber objEmp1.iIDNumber; 977 503 unsigned int iIDLength = strlen (ptrIDNumber)
but I get a syntax error saying I can not convert unsigned int to unsigned int *. I also get another syntax error that says I can not convert parameter 1 from unsigned int * to const char *. I do not understand this and I was hoping someone could help me out.
-Nut
Best Answer: Maybe since Game Design is so competitive, Needing years of experience in other areas of the Video Game industry before you can get your first shot.
Maybe you should invest your money and time in a better career for you?
Have you searched on the internet job sites to see how many Game Design positions there are and what the experience and other requirements are?
Have you searched the internet for the answers to the questions above?
These questions are subjective to what you are studying…
Terminology is never standard.
My Guesses are B C B D B ? B C C C
Some of these questions should be easy if you are familiar with Game Design and playing Video Games.
Registry Error Cleaner
Re:You could make a member function that returns the length.
int objEmp1::GetLength( void ) const
{
int base10 = 10;
int length = 1;
int temp = iIDNumber
if (temp < 0)
temp *= -1;
while (base10 < temp)
{
base10 *= 10;
length++;
}
return (length);
};
Error Doctor 2011 – Super Affiliates Get Paid Bonuses!
Re:Yeah, I'm trying to find out how many digits they enter. Remeber, I'm a newb so bare with me and thanks guy for the link, much appreciated.
Scan and Fix Errors in Windows Registry
Re:unsigned int *ptrIDNumber = objEmp1.iIDNumber;
ptrIDNumber is a pointer to an integer whereas objEmp1.iIDNumber is (from the looks of it) an integer. The correct syntax would be:
unsigned int *ptrIDNumber = &objEmp1.iIDNumber;
unsigned int iIDLength = strlen(ptrIDNumber);
strlen is used to find the length of a string but you are giving it a pointer to an integer. What exactly are you trying to do? Count the digits in a string representation of that number?
ErrorSmart #1 Error Repair Tool
Re:In that first line of code, you are creating a pointer but not giving that pointer an address. It appears objEmp1.iIDNumber is an unsigned integer but you need to set the pointer to the memory address of objEmp1.iIDNumber.
In the second line of code, the problem is that strlen() is a function which takes a parameter of type const *char – otherwise known as a C-style string. objEmp1.iIDNumber is not of type const *char and so you must first convert it to that type using some other function which is very likely found in the header file <string.h>.
C++ can get very confusing at times, so it's good to have a good fundamentals overview at hand while coding. Here's a decent one you can check out that will explain in detail why you can't do what you'd like to do: C++ Tutorial (http://www.cplusplus.com/doc/tutorial/index.html)
Page-Cannot-Be-Displayed.net___PC Error Fixer___This is Not a Registry Cleaner, its Better!
Re:class Money
{
public:
// Constructors
Money( void ); //Initializes to $0.00
Money( float value ); //Initializes to value
Money( long dollars, long cents = 0,
bool negative = false ); //Initializes to dollars.cents
Money( const Money& copy ); //Makes a copy
private:
long pennies;
};
void main()
{
Money greenback1;
int i = sizeof(greenbback1);
std::cout << "Size of GreenBack1: " << i << std::endl;
}
Is this what you are looking for? This example returns the size of my Money class which is the size of a long.
Related posts
Tags: gt 5, syntax error