Basic Elements of C++ language / PDF


Basic Elements of C++ language / PDF


Basic Elements of C++ language / PDF





Sample of the PDF document 






The Basics of a C++ Program
        
1.      A C++ program is essentially a collection of one or more subprograms, called functions. Note that although many functions are predefined in the C++ library, programmers must learn how to write their own functions to accomplish specific tasks.
         
2.      Every C++ program must have a function called main. Example 2-1 to illustrate a basic main function.
          
3.      Define the terms syntax and semantic as they relate to a programming language and explain the difference between the two.
         

Compilers check for syntax but not semantic errors. Give an example of each type of error.

      
4.      Explain that the C++ programming language consists of individual units called tokens, and that these are divided into special symbols, word symbols, and identifiers.
          
         Special Symbols
          
1.      Go over some of the special symbols in C++, including mathematical symbols, punctuation marks, the blank symbol, and double characters that are regarded as a single symbol.

Word Symbols


1.      Discuss the word symbols, or keywords, used in C++, using Appendix A as a guide.  C++ keywords are reserved and cannot be redefined for any other purpose with a program. 
          
         Identifiers
         
1.      Define the term identifier as a name for something, such as a variable, constant, or function. 
          
2.      Discuss the rules for naming identifiers in C++. Also note that C++ is a case sensitive language.
         

Discuss the difference between C++ conventions and rules. For example, it is a rule that a mathematical symbol cannot be used in an identifier name. However, it is a convention to begin an identifier with a lowercase letter.
          
          
    
Data Types
  
1.      Explain that C++ categorizes data into different types in order to manipulate the data in a program correctly. Although it may seem cumbersome at first to be so type-conscious, emphasize that C++ has these built-in checks to guard against errors.
         
2.      Mention that C++ data types fall into three categories: simple data types, structured data types, and pointers. Only the first type is discussed in this chapter.   
          
         Simple Data Types
          
1.      Using Figure 2-2, describe the three categories of simple data types in C++: integral, floating-point, and enumeration.
          
2.      Using Figure 2-3, mention the nine categories of integral data types. Explain why C++   (and many other languages) has so many categories of the same data type. In addition, discuss the rules involving the use of integral types.
         
3.      Explain the purpose of the bool data type.
        
4.      Discuss the char data type, including its primary uses. A char data type is enclosed in single quotation marks, and note that only one symbol may be designated as a character.
         
         Floating-Point Data Types
          
1.      Use Figure 2-3 to explain how C++ represents real, or floating-point, numbers. Mention the three categories of data types to represent real numbers (float, double, and long double), and explain when to use each type.
        
2.      Define the terms precision, single precision, and double precision......










Download Basic Elements of C++ language / PDF












Basic Elements of C++ language / PDF




0 commentaires: