最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

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

這些是什么錯(cuò)誤?怎么改?實(shí)在看不出來了

這些是什么錯(cuò)誤?怎么改?實(shí)在看不出來了

C C++
xungeer29 2017-10-25 09:47:55
#include<iostream> #include<string> using?namespace?std; //const?int?Asize?=?20; void?function(CandyBar?&,?char?*b?=?"Millennium?Munch",?double?w?=?2.85,?int?c?=?350); void?show(const?CandyBar?&); struct?CandyBar { ?//char?brand[Asize]; ?string?brand; ?double?weight; ?int?calorie; }; int?main() { ?CandyBar?candy; ?cout?<<?"Enter?brand:"?<<?endl; ?//cin.getline(candy.brand,Asize); ?getline(cin,?candy.brand); ?cout?<<?"Enter?weight:"?<<?endl; ?cin?>>?candy.weight; ?cout?<<?"Enter?calorie"?<<?endl; ?cin?>>?candy.calorie; ?show(candy); ?function(candy); ?show(candy); ?return?0; } void?show(const?CandyBar?&cb) { ?cout?<<?cb.brand?<<?endl ??<<?cb.weight?<<?endl ??<<?cb.calorie?<<?endl; } void?function(CandyBar?&CB,?char?*b,?double?w,?int?c) { ?CB.brand?=?b; ?CB.weight?=?w; ?CB.calorie?=?c; } 1>------?已啟動(dòng)生成:?項(xiàng)目:?homework8_2,?配置:?Debug?Win32?------ 1>homework8_2.cpp 1>e:\gfx\visual?studio\cpp_primer_plus\unit8\homework8_2\homework8_2\homework8_2.cpp(5):?error?C2065:?“CandyBar”:?未聲明的標(biāo)識(shí)符 1>e:\gfx\visual?studio\cpp_primer_plus\unit8\homework8_2\homework8_2\homework8_2.cpp(5):?error?C2059:?語法錯(cuò)誤:“,” 1>e:\gfx\visual?studio\cpp_primer_plus\unit8\homework8_2\homework8_2\homework8_2.cpp(6):?error?C4430:?缺少類型說明符?-?假定為?int。注意:?C++?不支持默認(rèn)?int 1>e:\gfx\visual?studio\cpp_primer_plus\unit8\homework8_2\homework8_2\homework8_2.cpp(6):?error?C2143:?語法錯(cuò)誤:?缺少“,”(在“&”的前面) 1>e:\gfx\visual?studio\cpp_primer_plus\unit8\homework8_2\homework8_2\homework8_2.cpp(24):?error?C2664:?“void?show(const?int)”:?無法將參數(shù)?1?從“CandyBar”轉(zhuǎn)換為“const?int” 1>e:\gfx\visual?studio\cpp_primer_plus\unit8\homework8_2\homework8_2\homework8_2.cpp(24):?note:?沒有可用于執(zhí)行該轉(zhuǎn)換的用戶定義的轉(zhuǎn)換運(yùn)算符,或者無法調(diào)用該運(yùn)算符 1>e:\gfx\visual?studio\cpp_primer_plus\unit8\homework8_2\homework8_2\homework8_2.cpp(25):?error?C3861:?“function”:?找不到標(biāo)識(shí)符 1>e:\gfx\visual?studio\cpp_primer_plus\unit8\homework8_2\homework8_2\homework8_2.cpp(26):?error?C2664:?“void?show(const?int)”:?無法將參數(shù)?1?從“CandyBar”轉(zhuǎn)換為“const?int” 1>e:\gfx\visual?studio\cpp_primer_plus\unit8\homework8_2\homework8_2\homework8_2.cpp(26):?note:?沒有可用于執(zhí)行該轉(zhuǎn)換的用戶定義的轉(zhuǎn)換運(yùn)算符,或者無法調(diào)用該運(yùn)算符 1>已完成生成項(xiàng)目“homework8_2.vcxproj”的操作?-?失敗。 ==========?生成:?成功?0?個(gè),失敗?1?個(gè),最新?0?個(gè),跳過?0?個(gè)?==========
查看完整描述

1 回答

已采納
?
onemoo

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

第 5、6 行的函數(shù)聲明中都用到了 CandyBar 類型,可是 struct?CandyBar 的聲明在它們后面!

把?struct?CandyBar 聲明提前就可以了。

查看完整回答
1 反對 回復(fù) 2017-10-25
  • 1 回答
  • 0 關(guān)注
  • 1661 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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