Lecture Introduction to computer and programming - Lecture No 5

In this chapter, the following content will be discussed: Assembly language programming - Moving up a level, an assembly language program, the assembly process, beyond the assembly of a single assembly language program. | CSC103: Introduction to Computer and Programming Lecture No 5 Previous lecture A first C program Comments Single line Multi line Preprocessor directive main() function keywords Program statement Today’s lecture outline Escape sequences C compiler Directives Common errors Components of C Program /* C Programming for the Absolute Beginner */ //by Michael Vine #include main() { printf("\n C you later \n") ; } multi-line comment block single line comment block preprocessor directive standard input output library begin logical program block end logical program block program statement program statement terminator printf function escape sequence Escape Sequence Escape sequences are specially sequenced characters used to format output printf("\nC you later\n"); This printf() function adds two new lines for formatting purposes. Before text is shown, the program outputs a new line. After the text is written to standard output. Escape Sequence \n printf("line 1\nline2\nline3\n"); line 1 line 2 line 3 _ printf("C "); printf("for the "); printf("Absolute Beginner\n"); C for the Absolute Beginner _ Go to Program Escape Sequence \t Escape sequence \t moves the cursor to the next tab space. printf("\nSun\tMon\tTue\tWed\tThu\tFri\tSat\n"); printf("\t\t\t\t1\t2\t3\n"); printf("4\t5\t6\t7\t8\t9\t10\n"); printf("11\t12\t13\t14\t15\t16\t17\n"); printf("18\t19\t20\t21\t22\t23\t24\n"); printf("25\t26\t27\t28\t29\t30\t31\n"); Go to Program Escape Sequence \r printf("This escape sequence moves the cursor "); printf("to the beginning of this line\r"); printf("This escape sequence moves the cursor \r"); printf("to the beginning of this line"); This escape sequence moves the cursor to the beginning of this line to the beginning of this line cursor Go to Program Escape Sequence \\ Escape sequence \\ inserts a single backslash \ in your text. When a program reads a backslash in a printf() function, it expects to see a valid escape character right after it. Backslash character (\) is a | CSC103: Introduction to Computer and Programming Lecture No 5 Previous lecture A first C program Comments Single line Multi line Preprocessor directive main() function keywords Program statement Today’s lecture outline Escape sequences C compiler Directives Common errors Components of C Program /* C Programming for the Absolute Beginner */ //by Michael Vine #include main() { printf("\n C you later \n") ; } multi-line comment block single line comment block preprocessor directive standard input output library begin logical program block end logical program block program statement program statement terminator printf function escape sequence Escape Sequence Escape sequences are specially sequenced characters used to format output printf("\nC you later\n"); This printf() function adds two new lines for formatting purposes. Before text is shown, the program outputs a new line. After the text is written to standard output. Escape Sequence \n printf("line 1\nline2\nline3\n"); line

Bấm vào đây để xem trước nội dung
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.