刚刚学习C++不大懂请大家教教我

来源:百度知道 编辑:UC知道 时间:2024/05/19 22:42:44
#include "iostream.h"
int main()
{
cout<<"shit shit shit !";
return 0;
}

请问这行代码错在哪呢?
我按F5后出现这个 谁能告诉我呢
trying.exe - 1 error(s), 0 warning(s)

iotream.h要用尖括号<>,即<iostream.h>
用引号的话会在当前目录下查找头文件,但你的当前目录下肯定没有iostream.h。
尖括号是在编译器的include目录下查找。

头文件 引用系统库函数似乎用<>,引用自定义库函数用"",而且iostream后面是不需要加.h的
底下还要加一句:using namespace std;

貌似C++的读入输出流头文件不要.h,也就是说你的程序第一行写成
#include<iostream>试试
如果还不行,那么再加上域试试,也就是在包含头文件的接下来一行加入
using namespace std;

#include <iostream>
using namespace std;

int main()
{
cout<<"shit shit shit!"<<endl;
return 0;
}

名空间问题 第二行加using namespace std; 或者 在cout前加std::

3楼正解