Essential C ++ Primer

xiaoxiao2021-03-06  41

Please "Learning Standard C As a New Language", And "Speaking C As a Native" friend's company also writes "with C" code with C , and then pour a bitter water every day, I have worked hard. The company also has a few thousand rows of C-style functions here to overview C most basic usage, can only be considered preparatory work before entering

First, the programming itself

Description Problem for a Solution to people with people for communicating with computer

Suppose the solution is the description of the problem itself, then this is perfect, such as Select * from books; and current mainstream development platform does not do this, so there are two space we need to handle, "problem space" and "" The description of the algorithm is depends on the natural language. Anyone who is not saying that people will remain silent. The expression of the program relies on programming language learning C , which is used with C terms, the vocabulary describes the two spaces, not a C language term. Vocabulary; other languages ​​are therefore, you should first become familiar with C itself

Second, the language itself

Don't pay attention to objects, don't pay attention to generic programming, don't pay attention to functional programming, don't pay attention to generating programming, before going to learn the mother tanguar, you have learned to use human language to express your anger, not with puppies or other Animal language has also learned how to use human language to ask your beloved toys; let us use C language to be a toy program: read a text file, and the string formed by each line of text is from small Large sort, then write the sorted content to another file analysis: Impactics in the problem: Into the file, string, output file algorithm space: Read, buffer, sort, write C description: Enter file: Ifstream string: string output file: OFSTream read: getLine buffer: vector, vector.push_back Sort: Sort Write: Copy End Program:

INT main () {ifstream Fin ("in.txt"); // Enter file vector buf; // buffer String D; // string temporary object while (Getline (Fin, D)) buf.push_back (D); // read, and buffer sort (buf.begin (), buf.end ()); // Sorting OFSTream Fout ("out.txt"); // Output file copy (buf.begin (), BUF.End (), ostream_iterator (fout, "/ n")); // write}

No CHAR * [], Scanf, Printf, OpenFile et al.

Third, entry

At least four textbooks can be used for "correct C correct entry", recommended reading Essential C C Primerthe C Programming Languagethe C Standard Library

Fourth, improve

转载请注明原文地址:https://www.9cbs.com/read-55322.html

New Post(0)