LESSON 4 Flashcards
are used for storing texts.
Strings
contains a collection of characters surrounded by double quotes.
string variable
To use strings, you must include an additional header file in the source code,
include <string></string>
To get the length of a string, use the _________ function.
length ()
==
!=
>
>=
<
<=
equal to
not equal to
greater than
greater than or equal to
less than
less than or equal to
!
&&
||
Logical NOT
Logical AND
Logical OR
Logical Exclusive OR (XOR)
means that it should produce correct and faster results, taking into account all the memory constraints.
Good Program
4 Characteristics of Good Programming
1) Clarity and Simplicity of Expression
2) Use of proper names for identifiers
3) Comments
4) Indentation
Expressions are use to implement a particular task. It is a combination of Operators, Operands, and Constants. Any expression used in the program should be understood by the user.
1) Clarity and Simplicity of Expression
Identifiers are user defined names. They are use to name things. A name is associated with a function or data object (constants and variables) and used to refer to that function or data object. Identifiers are made up of letters (A-Z, a-z), digits (0-9), and the underscore character ( _ ). They, however, must begin with a letter or underscore and not with a digit.
2) Use of proper names for identifiers
They are usually added with the purpose of making the source code easy to understand. Hence, add ___________to your code in simple English language that describes the function of the code and the reason for your decision to do it in a particular way as well.
3) Comments
Leading white space (spaces and tabs) at the beginning of each statement, which is used to determine the group of statements, is known as _________.
- Indentation
A computer program should have some important characteristics, which are as follows :
1) Flexibility
2) User Friendly
3) Portability
4) Reliability
5) Self-Documenting Code
A program should be _______ enough to handle most of the changes without having to rewrite the entire program.
Flexibility; flexible
A program that can be easily understood by a beginner is called
2) User-Friendly
It must interact with the user through understandable messages. In addition, the proper message for the user to input data and to display the result, besides making the program easily understandable and modifiable.
2) User-Friendly
refers to the ability of an application to run on different platforms (operating systems) with or without minimal changes. Since the change of platform is a common phenomenon nowadays, due to the developments in hardware and the software, portability has to be taken care of it.
3) Portability
It is the ability of a program to do its intended function accurately even if there are even small changes in the computer system.
Moreover, the program must be able to handle unexpected situations like wrong input or no input.
4) Reliability
The source code, which uses a suitable name for the identifiers (variables and methods), is called the _______
5) Self-Documenting Code
Also, giving a proper name for variables and methods would tell the reader of your code clearly.
5) Self-Documenting Code