Re: 1>check.obj : error LNK2019: unresolved external symbol "void

Posted 15 October 2012 - 08:05 PM

Where have you defined a function with the name spell() that takes no arguments? You told the compiler that spell would have no arguments in your function prototype on line 3 yet you never implemented a function named spell with no arguments. Remember your function prototype, function implementation, and function call all must agree as to the number and type of arguments.

This is my revised code and I'm no longer getting an error. However, my goal is to print out the dollar amount in words in my first function at that point and when it gets to the function call it just doesn't do anything. I'm not getting an error but it isn't working.

Re: 1>check.obj : error LNK2019: unresolved external symbol "void

I wasn't trying to input it I was just trying to use the value. I changed that and I also realized I needed a return and is attached to my new code...however it is saying that name2 is uninitialized and it is outputting '20' which if name2 is going to hold the written version of a number it can't be int but it isn't letting me define the function as 'string spell(amountd)'

Re: 1>check.obj : error LNK2019: unresolved external symbol "void

Posted 15 October 2012 - 09:21 PM

I'm attempting to make '20' in the function spell be broken up to be 2 being digit one and 0 being digit two. It has to work for any input dollar amount between 10 and 99 so it needs to be able to evaluate the string and then go through the switches and assign it a written value.

Re: 1>check.obj : error LNK2019: unresolved external symbol "void

Posted 16 October 2012 - 02:14 AM

So basically I'm extremely confused. When debugging my code I am using a string 'amountd' which is input by the user in the beginning of the program. The input has to be a two digit number and for my example lets say I'm using 20. I have debugged the following code:

int k=0, w=0;
cout << amountd[0];
cout << "x";
cout << amountd[1];

The x is just to separate the two clearly. Basically what I'm trying to do is assign 2 to the variable k and 0 to the variable w. When I output amound[0] it outputs the number 2. When I output amountd[1] it outputs the number 0. However, if I were to type amountd[0] = k and then output k it would output a random number (48 I believe it was). And the same with w. Why is it that amound[0] is clearly 2 and when I set it equal to something it has a problem?

Re: 1>check.obj : error LNK2019: unresolved external symbol "void

Posted 16 October 2012 - 03:06 AM

A string is a sequence of values which map to characters. In this case, I assume you're using ASCII and not other characters sets like Unicode. An ASCII '2' is not the same as the integer value 2. In fact, the ASCII value of '2' is represented as the value 50.

To convert between ASCII values and integer values, you should subtract the ASCII value of '0' (48). For example.