中央新闻主持人贵州籍:请教关于C++d问题

来源:百度文库 编辑:高校问答 时间:2024/04/27 10:33:48
为什么我输入这个代码
#include<iostream.h>
using namespace std;
int main(){
int iarr[5]={14,15,17,45,81};
int *iprt=&iarr[0];
cout<<"iarr[2]="<<iarr[2]<<endl;
cout<<"*(iprt+2)="<<*(iprt+2)<<endl;
}
电脑 却显示
error C2871: 'std' : does not exist or is not a namespace

前面你的#include<iostream.h> 中
已经写了.h , 后面就不需要using namespace std 了
如果前面是#include<iostream> , 后面才需要using namespace std