zoukankan      html  css  js  c++  java
  • C++第七章经验整理2

    Dynamic strings(dynamic length) are stored in heap and static string(with fixed size) are stored in stack.

    These are the items which will have their change in declaration related to constness of parameter. They are strchr, strpbrk, strrchr, strstr, memchr.

     The floating point number composed of four elements. They are sign, Base, Significand and Exponent.

    There are two groups of output operation in c++. They are formatted output and unformatted output.

     cout, cerr and clog are the standard objects for the instantiation of output stream class.

    There are three output stream classes in c++. They are ostream, ofstream and ostrstream.

     If you construct an object of class ostream, you must specify a streambuf object to the constructor.

    When you give some input to console the processing of the input starts when the user presses enter/return key.

    Whitespace is a term that refers to characters like spaces, tabs, and newlines that are used for formatting purposes.

    The default number of spaces is 4 in programming.

    setw function of iomanip header file allows you to set minimum width for the next input.

    showbase is used to indicate the base used.

    The member function seekg is used to position back from the end of file object.

    In this program, if the file exist, it will read the file. Otherwise it will throw an exception. A runtime error will occur because the value of the length variable will be “-1” if file doesn’t exist and in line 13 we are trying to allocate an array of size “-1”.

    The member function is_open can be used to determine whether the stream object is currently associated with a file.

    10. Which header file is used for reading and writing to a file?

    A stream buffer is a block of data that acts as intermediary between the i/o operations and the physical file associated to the stream.

     fclose() is used to close the file and flush it out of memory for safe closing of files opened during the execution of program. In short to avoid memory faults during the execution of the program.

    There are streams that are automatically created when executing a program. They are stdin, stdout and stderr.

    There are three indicators are available in C++. They are Error indicator, End-Of-File indicator and Position indicator.

    Numeric limits provides the information about the properties of arithmetic types.

    Max function in the numeric limit will return the maximum finite value for a float type.

    The trigonometric functions work with angles in radians rather than degrees.

    Time can be used to create a random number without duplication.

    C++ allows to use one or more file opening mode in a single open() method. ios::in and ios::out are input and output file opening mode respectively.

    By default, all the files in C++ are opened in text mode. They read the file as normal text.

    ios::set is not used to seek file pointer. ios::end is used to seek from the end of the file. ios::curr from the current position. ios::beg from the beginning.

    C++ provides tell_p() function to get the current position of the file pointer in a file.

    seekg() function is used to reposition a file pointer in a file. The function takes the offset and relative position from where we need to shift out pointer.

    Lambda expression is a technique available in C++ that helps the programmer to write inline functions that will be used once in a program and so there is no need of providing names top them. Hence they are a type of inline functions without names.

    As this lambda expression is capturing the extrenal variable by value therefore the value of a cannot be changes inside the lambda expression hence the program gives error.(but reference can do)

  • 相关阅读:
    查看lwjgl常用状态的值
    微信公众号开发java框架:wx4j(MenuUtils篇)
    微信公众号开发java框架:wx4j(KefuUtils篇)
    微信公众号开发java框架:wx4j(MaterialUtils篇)
    微信公众号开发java框架:wx4j(入门篇)
    hashcode和equals方法小记
    https单向认证和双向认证区别
    java开发中获取路径的一些方式
    iOS使用sqlite3原生语法进行增删改查以及FMDB的使用
    IOS自动布局
  • 原文地址:https://www.cnblogs.com/hhlys/p/13543789.html
Copyright © 2011-2022 走看看