第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

簡(jiǎn)單的C++輸出語(yǔ)句糾錯(cuò)?

簡(jiǎn)單的C++輸出語(yǔ)句糾錯(cuò)?

C++
繁花如伊 2019-02-15 15:11:02
程序如下:#include <iostream.h>using namespace std;int main(){cout<<"Hello!\n";cout<<"Welcome to C++!\n";}在VC++ 6.0中編譯錯(cuò)誤如下::\My Documents\我的資料\VC++\2_1B\2_1B.CPP(2) : error C2871: 'std' : does not exist or is not a namespaceE:\My Documents\我的資料\VC++\2_1B\2_1B.CPP(7) : warning C4508: 'main' : function should return a value; 'void' return type assumed執(zhí)行 cl.exe 時(shí)出錯(cuò).2_1B.OBJ - 1 error(s), 0 warning(s)請(qǐng)問(wèn)這是什么原因?
查看完整描述

2 回答

?
千萬(wàn)里不及你

TA貢獻(xiàn)1784條經(jīng)驗(yàn) 獲得超9個(gè)贊

哎 寫(xiě)了那么多
結(jié)果沒(méi)發(fā)表出來(lái) 郁悶
現(xiàn)在大概說(shuō)下
給你2個(gè)改好了的程序
1:#include <iostream>
using namespace std;
int main()
{
cout<<"Hello!\n";
cout<<"Welcome to C++!\n";
return 0;
}
2.#include <iostream.h>
int main()
{
cout<<"Hello!\n";
cout<<"Welcome to C++!\n";
}
錯(cuò)誤解釋
錯(cuò)誤1:
:\My Documents\我的資料\VC++\2_1B\2_1B.CPP(2) : error C2871: 'std' : does not exist or is not a namespace
這里相當(dāng)
#include <iostream.h>與
#include <iostream>
using namespace std;等效
錯(cuò)誤2:E:\My Documents\我的資料\VC++\2_1B\2_1B.CPP(7) : warning C4508: 'main' : function should return a value; 'void' return type assumed
執(zhí)行 cl.exe 時(shí)出錯(cuò).

int main()是需要return 0;這個(gè)語(yǔ)句的
而void main()不需要

ANIS C++標(biāo)準(zhǔn)有了新的規(guī)定,要求主函數(shù)為int類型,如果程序正常執(zhí)行則返回0值;系統(tǒng)頭文件不帶后綴.h;使用系統(tǒng)庫(kù)時(shí)使用命名空間std;



查看完整回答
反對(duì) 回復(fù) 2019-03-01
  • 2 回答
  • 0 關(guān)注
  • 906 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)