tailieunhanh - Lecture Introduction to Computer Programming - Lecture 6

This lesson looks at the processors most commonly found in personal computers and describes some of their most important features and distinguishing characteristics. You w ill learn how these CPUs arc typically differentiated from one another and sec how their performance is measured. You also w ill learn some of the ways you can extend the power of your PC’s processor to other components by using its expansion capabilities. | CSC141 Introduction to Computer Programming Teacher: AHMED MUMTAZ MUSTEHSAN Lecture - 6 Do not Confuse between C and C++ C is a structured language C++ is an object oriented language C++ supports most of the features of structure language hence you may say C is a subset of C++ (with few exceptions that you need not to worry at this stage) CSC141 Introduction to Computer Programming Declaration, definition and initialization of variables User input/output functions scanf() and printf() printf () Function Format specifier Field width specifier Escape sequence Scanf( ) function Address operator For loop Structure of the for loop Initialization, test, increment expression Body of the for loop Operation of the for loop Multiple statements in for loop Multiple initialization in a for loop CSC141 Introduction to Computer Programming Defining and Declaring variables A variable declaration only specifies the name and type of the variable without allocating memory to it Declarations are important in multi file programs where a variable defined in one file must be referred to in a second file. Variable definition on the other hand specifies the name and type of the variable and also sets aside memory for it. When a data is assigned first time to the variable it is defined. (We will discuss it in detail when study functions) CSC141 Introduction to Computer Programming Initializing variables Examples int num=2; int char=‘d’, float length=; By initializing a variable we provide: Declaration of variable Definition of a variable Initial value loaded in the variable CSC141 Introduction to Computer Programming User Input and output functions The printf() function is used to display output on the screen The scanf() function is used to read input from the keyboard printf() and scanf() both are defined in called header file which we include using: # include CSC141 Introduction to Computer Programming The printf() function Printf() is a function like main() It | CSC141 Introduction to Computer Programming Teacher: AHMED MUMTAZ MUSTEHSAN Lecture - 6 Do not Confuse between C and C++ C is a structured language C++ is an object oriented language C++ supports most of the features of structure language hence you may say C is a subset of C++ (with few exceptions that you need not to worry at this stage) CSC141 Introduction to Computer Programming Declaration, definition and initialization of variables User input/output functions scanf() and printf() printf () Function Format specifier Field width specifier Escape sequence Scanf( ) function Address operator For loop Structure of the for loop Initialization, test, increment expression Body of the for loop Operation of the for loop Multiple statements in for loop Multiple initialization in a for loop CSC141 Introduction to Computer Programming Defining and Declaring variables A variable declaration only specifies the name and type of the variable without allocating memory to it Declarations are .

TỪ KHÓA LIÊN QUAN