# What is the difference between include <iostream> and # include <iostream. h> # include "iostream. h"
# Include <string>
Using namespace std;
Void main ()
{
String s1;
While (cin> s1)
Cout <s1 <endl;
}
This program adds. after h, it cannot be compiled. ========================================================== = many C ++ programmers are still using standard libraries instead of updating them.
What are the differences between the two? First, five years ago, we began to oppose the use of the. h symbol in the standard header.
File. It is not a good way to continue using outdated rules. In terms of functionality,
<Iostream> contains a series of templated I/O classes. On the contrary, <iostream. h> only supports characters.
Stream. In addition, the C ++ standard interface of the input/output stream has been improved in some subtle details. Therefore,
<Iostream> and <iostream. h> are different in terms of interfaces and execution. Finally, each group of <iostream>
Chengdu is declared as STL. However, the components of <iostream. h> are declared as global.
Because of these differences, you cannot confuse these two libraries in a program. As a kind of study
<Iostream> is generally used in new Code. However, if you are dealing with code written in the past
Inheritance can be used to continue to use <iostream. h> to maintain code consistency.
///////////////////
<Iostream> indicates that you are using the annotation namespace, that is, there should be such a sentence at the beginning of the program.
Using namespace std;
This follows the c ++ standard.
<Iostream. h>
The c ++ standard is not followed.
////////////////
<String. h> is the old C header file, which corresponds to a char *-based string processing function;
<String> the C ++ header file of std is packaged, corresponding to the new strng class;
<Cstring> is the std Version corresponding to the old C header file.