zoukankan      html  css  js  c++  java
  • lecture 9.18

    1. a && b: a and b;  a || b: a or b

    2. printf格式

    %d  十进制

    %f  小数点位置固定的数 (%m.nf, 字段长度为m位,空格补位,小数点后n位)

    %c  character

    %s  string

      new line

    "  quotation mark

    3. while与do while的区别是后者至少进行一次

    4. putchar(c)的作用是向终端输出一个字符,当c为被单引号引出的字符时输出该字符(可以为转义字符如 ),当c为介于0-127之间的十进制整型数时,输出该数字在ASCII码中对应的字符

    5. functions form

    return-type function-name(parameters) {

      declarations

      statements

      return ...;

    }

    if return-type is void then the function does not return a value

    if parameters is void then the function has no arguments

    parameter中的赋值会被计算,如f=3*3, f=9会被传递

    6. the return statement can also be used to terminate a function of return-type void

    return;

    7. double很像float,但是精度更高小数点后所允许的位数更多

    8. array is similar with list in python, which is a collection of same-type variables, for an array of size N, valid subscripts are 0...N-1

    9. #define放在开始,便于理解且便于修改,在assignment中不可以直接使用没有定义过的数

    10. C代码格式参照 https://wiki.cse.unsw.edu.au/info/CoreCourses/StyleGuide

    11. strings (functions不知道array的大小,所以对array的结尾进行标记)

    12. string是特殊形式的array,下面两者都可以,但是第二个可读性更高

    char s[6] ={ 'h', 'e', 'l', 'l', 'o', '' };

    char t[6] = "hello";

    13. input用scanf(format-string, expr1...), 不想input string时,用atoi(string), which convert string into integer

    需要先#include <stdlib.h>

    14. typedef的作用是给type取一个新名字

    15. structures可以是一个不同types结合起来的结果,复杂data时很有用,如:

    typedef struct {

      int day;

      int month;

      int year;

    } DateT;

    小的structure可以包含在一个更大的structure里面

    声明变量以分配内存如  DateT christmas;

    christmas.day = 25;

    christmas.month = 12;

    christmas.year = 2019;

    16. stack is first in last out, 不同于array你不能根据它的顺序将里面的元素提取出来,只能按照先进后出的原则来取,在递归中就用到了stack

    与queue不同

    17. 自己的herder file要用#include "Stack.h"格式

  • 相关阅读:
    java中的构造方法
    在CentOS6.4上安装GitLab
    java通过文件路径读取该路径下的所有文件并将其放入list中
    java IO流 内容整理
    Selenium Webdriver元素定位的八种常用方式
    揭秘Alltesting众测平台
    TestCenter中测试需求、测试用例、测试计划的评审方法
    测试管理工具(TestCenter)产品功能介绍
    Bug管理工具(TCE)之缺陷导入与导出
    Bug管理工具(TCE)之缺陷流程定制
  • 原文地址:https://www.cnblogs.com/eleni/p/11559500.html
Copyright © 2011-2022 走看看