Pythonchallenge's C + + learning Chapter-01

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.