Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Returns the sum of the values in the specified list.
- private static int sumList(List<int> list)
- {
- int sum = 0;
- foreach (int listItem in list)
- {
- sum += listItem;
- }
- return sum;
- }
- List<int> list = new List<int>();
- list.Add(2000000000);
- list.Add(2000000000);
- int sum = sumList(list);
- int main()
- {
- uint32_t shipsHeadingInDegrees= 0;
- // Rotate by a bunch of degrees
- shipsHeadingInDegrees+= 0x80000000; // 180 degrees
- shipsHeadingInDegrees+= 0x80000000; // another 180 degrees, overflows
- shipsHeadingInDegrees+= 0x80000000; // another 180 degrees
- // Ships heading now will be 180 degrees
- cout << "Ships Heading Is" << (double(shipsHeadingInDegrees) / double(0xffffffff)) * 360.0 << std::endl;
- }
Add Comment
Please, Sign In to add comment