BP-1-3 Introduction of C++

Chapter 01 Introduction of Programming

3. Introduction of C++

A C++ program must have a function named main defined in only one source document.

3.1 Lexer in C++
  1. symbol set

    • letters
    • numbers
    • special characters
      在这里插入图片描述
  2. word

    • Identifier is composed of letters, numbers and underline. A legal identifier can’t start with a number and can’t be keyword.

      • Capital letter and lowercase letter is different.
      • There will be some common practice in defining a user-defined identifier. Following them will make your code more easier to be understood by others.
    • Keyword is predefined by the language itself and conveys some special and fixed meanings, which also has its own pattern of usage.

    • Literal is composed of numbers, characters and strings.

    • Operator describes the operation on data, which is also called operands.

    • Punctuation plays a role in syntax and semantics.

    When editing a C++ code, the words above sometimes need to be separated using white-space character.

    Comment is also a kind of white-space character, which does some illustration and demonstration to help the reader or other coder under stand the content.

    There are two ways of writing comments:

    //till the end of this line.
    /* between thiese two special forms, and can include multiple lines*/
    

    \ is called continuation character, which allows you two write your code on the next line when the current line is not long enough.

3.2 Procedure for the Running of a C++ Program
  • editing

    • Use an editor to edit source code and store them in a document with a filename extension of .h or .cpp.
      在这里插入图片描述
  • compiling

    • Use a compiler(including a preprocessor, which will execute some part of the source code which is not actually a part of the C++ program) to translate the source code into the object code and store them in a document with a filename extension of .obj.在这里插入图片描述
  • linking

    • Use a linker to link all the files that make up the whole program and output an executive code stored in an executive document with a filename extension of .exe.
      在这里插入图片描述
  • executing/running
    在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值