TAILIEUCHUNG - A Complete Guide to Programming in C++ part 4

A Complete Guide to Programming in C++ part 4. This book provides both novice and experienced programmers with a comprehensive resource manual for the C++ programming language. Readers gain experience in all aspects of programming, from elementary language concepts to professional software development, with in depth coverage of all the language elements en route. These elements are carefully ordered to help the reader create useful programs every step of the way. | A BEGINNER S C PROGRAM A C program is made up of objects with their accompanying member functions and global functions which do not belong to any single particular class. Each function fulfills its own particular task and can also call other functions. You can create functions yourself or use ready-made functions from the standard library. You will always need to write the global function main yourself since it has a special role to play in fact it is the main program. The short programming example on the opposite page demonstrates two of the most important elements of a C program. The program contains only the function main and displays a message. The first line begins with the number symbol which indicates that the line is intended for the preprocessor. The preprocessor is just one step in the first translation phase and no object code is created at this time. You can type include filename to have the preprocessor copy the quoted file to this position in the source code. This allows the program access to all the information contained in the header file. The header file iostream comprises conventions for input and output streams. The word stream indicates that the information involved will be treated as a flow of data. Predefined names in C are to be found in the std standard namespace. The using directive allows direct access to the names of the std namespace. Program execution begins with the first instruction in function main and this is why each C program must have a main function. The structure of the function is shown on the opposite page. Apart from the fact that the name cannot be changed this function s structure is not different from that of any other C function. In our example the function main contains two statements. The first statement cout Enjoy yourself with C endl outputs the text string Enjoy yourself with C on the screen. The name cout console output designates an object responsible for output. The two less-than symbols indicate that characters

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.