is evaluated each time thus: &exit - &main is the offset from the start of main to the start of exit j/1000 will evaluate to zero for all vaules of j less than 1000
Multiplying those two values together gives zero if j is less than 1000.
Add that to &main (the address of main) and you get the same address, so main gets called with the parameter value j+1.
This continues until the value of j reaches 1000 at which time: j/1000 results in the value 1
That is multiplied by the offset of exit which returns that offset.
Add that value to main and the next call will go to exit rather than main.
I have an application developed in non-CLR C++ (unmanaged) in VS2003 (or earlier) but working with VS2005 after some converting. Note that I didn’t do that converting.
My employer decided to update the code to CLR VS2010 for easier maintenance. I am a C# programmer and haven’t done C++ for a while and not within VS so I’m not the most skilled in this task.
I’ve set it to CLR and corrected the errors and most of the warnings, but I’m having a problem with some image resources in the Form1.resX file (took me a while to even figure out that the resources were IN that .resx file I can see them in there and the Form [Design] editor can see the resource and paints the image as a background for its tab:
Create an STL vector of 10 integers and store initial values (0 to 9 is fine).
Use the std::random_shuffle algorithm to shuffle the list.
Print the list. (try to do this one with an std iterator)
Use the std::sort algorithm to sort the list.
Print the list again. (you can use for each instead of an iterator)
See if you can locate the documentation for random_shuffle and sort either in VS help or with Google. Once you leave this class, you will need to be able to find information like this on your own.
1. Did NOT create a folder for the solution
2. Project/solution named correctly
3. Correct comments at top
4. Consistent indentation
5. Good variable names
6. Overall neat organization
7. Comments in code explain what's being done
8. Correct division of code into .h and .cpp files
9. Use of #pragma once in .h files (or, #ifndef)
10. #include "stdafx.h" in cpp files (or, suppress pch)