C语言头文件iostream,iostream头文件C

1,iostream头文件C加了.h之后在main函数里,最后就不需要加上return的返回值,而如果没有.h就必须有一个return的返回值 。一般是不加,如果不加的话要加上一句引用命名空间using namespace std;如果加上.h的话就不用加上那一句了 。
2,C语言中书上的头文件是stdioh而vc60中的是iostreamstdio是C语言的标准库iostream是C++的标准流你去看看C++相关的书籍就发现,其实都是引用的iostream看你写代码的作用,一般用stdio编什么程序搞哪个头文件c语言程序扩展名 用.c不要用.cpp 于是 就不需要iostream 。例如:源程序 名: zga.c 程序内容:#include main(){ printf("Hello
3,请问如何在vc里用iostream和cstdlib头文件#include "stdafx.h"#include #include #include using namespace std;void main() string str = "Hello world.."; cout << str << endl; system("PAUSE");}再加一个就OK了呗 。#include using namespace std;int main()cout << "fuck" << endl;reurn 0;}#include "stdafx.h"#include #include #include using namespace std;void main(){ string str = "hello world.."; cout << str << endl; system("pause");}【C语言头文件iostream,iostream头文件C】
4,编程C什么时候用iostream什么时候用iostreamh<iostream>和<iostream.h>是不一样,前者没有后缀,实际上,在你的编译器include文件夹里面可以看到,二者是两个文件,打开文件就会发现,里面的代码是不一样的 。后缀为.h的头文件c++标准已经明确提出不支持了 , 早些的实现将标准库功能定义在全局空间里,声明在带.h后缀的头文件里 , c++标准为了和C区别开,也为了正确使用命名空间 , 规定头文件不使用后缀.h 。因此,当使用<iostream.h>时,相当于在c中调用库函数,使用的是全局命名空间,也就是早期的c++实现;当使用<iostream>的时候,该头文件没有定义全局命名空间,必须使用namespace std;这样才能正确使用cout 。所谓namespace,是指标识符的各种可见范围 。C++标准程序库中的所有标识符都被定义于一个名为std的namespace中 。iostream 就是标准输入输出流当你在程序中使用cin cout的时候就要用这个库如果你和C语言那样输入输出 , 就不用这个头文件usingnamespace 使用命名空间usingnamespacestd使用标准命名空间 std就是standand , 标准的意思一般都要用