Objective
Recently learned C + +, before the Python user, Python interpreter has a lot of implementations, the most famous for the number of C implementation, and many Python extension modules may be used in C or C + + to write, so it is necessary to learn C + +
In order to avoid learning grammar boring, put pythonchallenge to practice practiced hand, what? Don't know what this is? Try to figure it out.
My C + + environment: GCC compiler code editing in Windows MinGW Sublime
First Pass:
Objective: To calculate 2 of the 38-time
Solution:
1# include <iostream>2# include <math.h>3 4 intMain ()5 {6 intA=2, b= -;7 Long LongC;8C=Pow (A, b);9Std::cout << C <<Std::endl;Ten return 0; One}
Problems encountered and solutions:
1. When the C type is not declared, a direct return to the POW (A, A, a, b) and output compile can pass, but the runtime does not respond, crash: Write declaration C, use a small number by running
2. Using long declaration, unsigned long declaration to get the value of a symbol before, look up data found things beyond the range of expression, as if not heard the higher expression ah, looked up the data found the 64bit representation: long Long
Pythonchallenge's C + + learning Chapter-01