除了主函數(shù)以外的三個(gè)函數(shù)的返回類型都是void,但是函數(shù)體內(nèi)部卻有返回值,所以錯(cuò)了,把void改成int就可以了。
十多年的漢源網(wǎng)站建設(shè)經(jīng)驗(yàn),針對(duì)設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對(duì)一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。成都全網(wǎng)營(yíng)銷的優(yōu)勢(shì)是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整漢源建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無(wú)論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。成都創(chuàng)新互聯(lián)從事“漢源網(wǎng)站設(shè)計(jì)”,“漢源網(wǎng)站推廣”以來(lái),每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。
1、本來(lái)和樓上想的一樣,以為沒(méi)有定義sum和money,不過(guò)好像定義了。因?yàn)閟um是全局變量,好像也就不用初始化了。
2、定義的sum和money是float型的,所以下面輸入money時(shí)應(yīng)該是scanf("%f",money);
3、“scanf("%c",k);”前面要加一個(gè)getchar()吃掉之前的“printf("是否顯示余額?顯示請(qǐng)按Y,否則請(qǐng)按N\n");”的回車,否則讀不到用戶要輸入的字符,直接讀取了回車就會(huì)輸出"本次存款成功,但選擇錯(cuò)誤,無(wú)法顯示"的提示。
#includestdio.h
float score[3][2];
int i,j,xs=1,kc=1;
float pj(int i)
{float ping;
ping=(score[i][0]+score[i][1])/2;
return(ping);
}
float zuigao()
{
float max=0;
for(i=0;i3;i++)
for(j=0;j2;j++)
if(maxscore[i][j])
{
max=score[i][j];
xs=i;
kc=j;
}
return(max);
}
float zuidi()
{
float min=10000.0f; /*這里min初始化的值必須設(shè)置為一個(gè)大數(shù),而不是0*/
for(i=0;i3;i++)
for(j=0;j2;j++)
if(minscore[i][j])
{
min=score[i][j];
xs=i;
kc=j;
}
return(min);
}
void main()
{
float max=0,min=10000.0f; /*這里min初始化的值必須設(shè)置為一個(gè)大數(shù),而不是0*/
printf("請(qǐng)輸入3個(gè)學(xué)生的成績(jī),按照課程順序依次輸入:\n");
for(i=0;i3;i++)
{ printf("第%d個(gè)學(xué)生",i+1);
for(j=0;j2;j++)
{ printf("第%d門課的成績(jī):\n",j+1);
scanf("%f",score[i][j]);
}
}
for(i=0;i3;i++)
printf("第%d個(gè)學(xué)生的平均分為:%.2f\n",i+1,pj(i));
printf("\n");
min=zuidi();
printf("6個(gè)分?jǐn)?shù)中最低的分?jǐn)?shù)是第%d個(gè)學(xué)生的第%d門課,分?jǐn)?shù)為:%.2f\n",xs+1,kc+1,min);
max=zuigao();
printf("6個(gè)分?jǐn)?shù)中最高的分?jǐn)?shù)是第%d個(gè)學(xué)生的第%d門課,分?jǐn)?shù)為:%.2f\n",xs+1,kc+1,max);
}
1、一般是你在調(diào)用函數(shù)的時(shí)候傳遞的是int類型的數(shù)據(jù),但那個(gè)函數(shù)定義的參數(shù)類型不是int(比如是結(jié)構(gòu)或者指針或者數(shù)組)。
2、下面為C語(yǔ)言的錯(cuò)誤大全及中文解釋:
1: Ambiguous operators need parentheses — 不明確的運(yùn)算需要用括號(hào)括起
2: Ambiguous symbol xxx — 不明確的符號(hào)
3: Argument list syntax error — 參數(shù)表語(yǔ)法錯(cuò)誤
4: Array bounds missing — 丟失數(shù)組界限符
5: Array size toolarge — 數(shù)組尺寸太大
6: Bad character in paramenters — 參數(shù)中有不適當(dāng)?shù)淖址?/p>
7: Bad file name format in include directive — 包含命令中文件名格式不正確
8: Bad ifdef directive synatax — 編譯預(yù)處理ifdef有語(yǔ)法錯(cuò)
9: Bad undef directive syntax — 編譯預(yù)處理undef有語(yǔ)法錯(cuò)
10: Bit field too large — 位字段太長(zhǎng)
11: Call of non-function — 調(diào)用未定義的函數(shù)
12: Call to function with no prototype — 調(diào)用函數(shù)時(shí)沒(méi)有函數(shù)的說(shuō)明
13: Cannot modify a const object — 不允許修改常量對(duì)象
14: Case outside of switch — 漏掉了case 語(yǔ)句
15: Case syntax error — Case 語(yǔ)法錯(cuò)誤
16: Code has no effect — 代碼不可能執(zhí)行到
17: Compound statement missing{ — 分程序漏掉"{"
18: Conflicting type modifiers — 不明確的類型說(shuō)明符
19: Constant expression required — 要求常量表達(dá)式
20: Constant out of range in comparison — 在比較中常量超出范圍
21: Conversion may lose significant digits — 轉(zhuǎn)換時(shí)會(huì)丟失意義的數(shù)字
22: Conversion of near pointer not allowed — 不允許轉(zhuǎn)換近指針
23: Could not find file xxx — 找不到XXX文件
24: Declaration missing ; — 說(shuō)明缺少";"
25: Declaration syntax error — 說(shuō)明中出現(xiàn)語(yǔ)法錯(cuò)誤
26: Default outside of switch — Default 出現(xiàn)在switch語(yǔ)句之外
27: Define directive needs an identifier — 定義編譯預(yù)處理需要標(biāo)識(shí)符
28: Division by zero — 用零作除數(shù)
29: Do statement must have while — Do-while語(yǔ)句中缺少while部分
30: Enum syntax error — 枚舉類型語(yǔ)法錯(cuò)誤
31: Enumeration constant syntax error — 枚舉常數(shù)語(yǔ)法錯(cuò)誤
32: Error directive :xxx — 錯(cuò)誤的編譯預(yù)處理命令
33: Error writing output file — 寫輸出文件錯(cuò)誤
34: Expression syntax error — 表達(dá)式語(yǔ)法錯(cuò)誤
35: Extra parameter in call — 調(diào)用時(shí)出現(xiàn)多余錯(cuò)誤
36: File name too long — 文件名太長(zhǎng)
37: Function call missing ) — 函數(shù)調(diào)用缺少右括號(hào)
38: Fuction definition out of place — 函數(shù)定義位置錯(cuò)誤
39: Fuction should return a value — 函數(shù)必需返回一個(gè)值
40: Goto statement missing label — Goto語(yǔ)句沒(méi)有標(biāo)號(hào)
41: Hexadecimal or octal constant too large — 16進(jìn)制或8進(jìn)制常數(shù)太大
42: Illegal character x — 非法字符x
43: Illegal initialization — 非法的初始化
44: Illegal octal digit — 非法的8進(jìn)制數(shù)字 A
45: Illegal pointer subtraction — 非法的指針相減
46: Illegal structure operation — 非法的結(jié)構(gòu)體操作
47: Illegal use of floating point — 非法的浮點(diǎn)運(yùn)算
48: Illegal use of pointer — 指針使用非法
49: Improper use of a typedefsymbol — 類型定義符號(hào)使用不恰當(dāng)
50: In-line assembly not allowed — 不允許使用行間匯編
51: Incompatible storage class — 存儲(chǔ)類別不相容
52: Incompatible type conversion — 不相容的類型轉(zhuǎn)換
53: Incorrect number format — 錯(cuò)誤的數(shù)據(jù)格式
54: Incorrect use of default — Default使用不當(dāng)
55: Invalid indirection — 無(wú)效的間接運(yùn)算
56: Invalid pointer addition — 指針相加無(wú)效
57: Irreducible expression tree — 無(wú)法執(zhí)行的表達(dá)式運(yùn)算
58: Lvalue required — 需要邏輯值0或非0值
59: Macro argument syntax error — 宏參數(shù)語(yǔ)法錯(cuò)誤
60: Macro expansion too long — 宏的擴(kuò)展以后太長(zhǎng)
61: Mismatched number of parameters in definition — 定義中參數(shù)個(gè)數(shù)不匹配
62: Misplaced break — 此處不應(yīng)出現(xiàn)break語(yǔ)句
63: Misplaced continue — 此處不應(yīng)出現(xiàn)continue語(yǔ)句
64: Misplaced decimal point — 此處不應(yīng)出現(xiàn)小數(shù)點(diǎn)
65: Misplaced elif directive — 不應(yīng)編譯預(yù)處理elif
66: Misplaced else — 此處不應(yīng)出現(xiàn)else
67: Misplaced else directive — 此處不應(yīng)出現(xiàn)編譯預(yù)處理else
68: Misplaced endif directive — 此處不應(yīng)出現(xiàn)編譯預(yù)處理endif
69: Must be addressable — 必須是可以編址的
70: Must take address of memory location — 必須存儲(chǔ)定位的地址
71: No declaration for function xxx — 沒(méi)有函數(shù)xxx的說(shuō)明
72: No stack — 缺少堆棧
73: No type information — 沒(méi)有類型信息
74: Non-portable pointer assignment — 不可移動(dòng)的指針(地址常數(shù))賦值
75: Non-portable pointer comparison — 不可移動(dòng)的指針(地址常數(shù))比較
76: Non-portable pointer conversion — 不可移動(dòng)的指針(地址常數(shù))轉(zhuǎn)換
77: Not a valid expression format type — 不合法的表達(dá)式格式
78: Not an allowed type — 不允許使用的類型
79: Numeric constant too large — 數(shù)值常太大
80: Out of memory — 內(nèi)存不夠用
81: Parameter xxx is never used — 能數(shù)xxx沒(méi)有用到
82: Pointer required on left side of - — 符號(hào)-的左邊必須是指針
83: Possible use of xxx before definition — 在定義之前就使用了xxx(警告)
84: Possibly incorrect assignment — 賦值可能不正確
85: Redeclaration of xxx — 重復(fù)定義了xxx
86: Redefinition of xxx is not identical — xxx的兩次定義不一致
87: Register allocation failure — 寄存器定址失敗
88: Repeat count needs an lvalue — 重復(fù)計(jì)數(shù)需要邏輯值
89: Size of structure or array not known — 結(jié)構(gòu)體或數(shù)給大小不確定
90: Statement missing ; — 語(yǔ)句后缺少";"
91: Structure or union syntax error — 結(jié)構(gòu)體或聯(lián)合體語(yǔ)法錯(cuò)誤
92: Structure size too large — 結(jié)構(gòu)體尺寸太大
93: Sub scripting missing ] — 下標(biāo)缺少右方括號(hào)
94: Superfluous with function or array — 函數(shù)或數(shù)組中有多余的""
95: Suspicious pointer conversion — 可疑的指針轉(zhuǎn)換
96: Symbol limit exceeded — 符號(hào)超限
97: Too few parameters in call — 函數(shù)調(diào)用時(shí)的實(shí)參少于函數(shù)的參數(shù)不
98: Too many default cases — Default太多(switch語(yǔ)句中一個(gè))
99: Too many error or warning messages — 錯(cuò)誤或警告信息太多
100: Too many type in declaration — 說(shuō)明中類型太多
101: Too much auto memory in function — 函數(shù)用到的局部存儲(chǔ)太多
102: Too much global data defined in file — 文件中全局?jǐn)?shù)據(jù)太多
103: Two consecutive dots — 兩個(gè)連續(xù)的句點(diǎn)
104: Type mismatch in parameter xxx — 參數(shù)xxx類型不匹配
105: Type mismatch in redeclaration of xxx — xxx重定義的類型不匹配
106: Unable to create output file xxx — 無(wú)法建立輸出文件xxx
107: Unable to open include file xxx — 無(wú)法打開被包含的文件xxx
108: Unable to open input file xxx — 無(wú)法打開輸入文件xxx
109: Undefined label xxx — 沒(méi)有定義的標(biāo)號(hào)xxx
110: Undefined structure xxx — 沒(méi)有定義的結(jié)構(gòu)xxx
111: Undefined symbol xxx — 沒(méi)有定義的符號(hào)xxx
112: Unexpected end of file in comment started on line xxx — 從xxx行開始的注解尚未結(jié)束文件不能結(jié)束
113: Unexpected end of file in conditional started on line xxx — 從xxx 開始的條件語(yǔ)句尚未結(jié)束文件不能結(jié)束
114: Unknown assemble instruction — 未知的匯編結(jié)構(gòu)
115: Unknown option — 未知的操作
116: Unknown preprocessor directive: xxx — 不認(rèn)識(shí)的預(yù)處理命令xxx
117: Unreachable code — 無(wú)路可達(dá)的代碼
118: Unterminated string or character constant — 字符串缺少引號(hào)
119: User break — 用戶強(qiáng)行中斷了程序
120: Void functions may not return a value — Void類型的函數(shù)不應(yīng)有返回值
121: Wrong number of arguments — 調(diào)用函數(shù)的參數(shù)數(shù)目錯(cuò)
122: xxx not an argument — xxx不是參數(shù)
123: xxx not part of structure — xxx不是結(jié)構(gòu)體的一部分
124: xxx statement missing ( — xxx語(yǔ)句缺少左括號(hào)
125: xxx statement missing ) — xxx語(yǔ)句缺少右括號(hào)
126: xxx statement missing ; — xxx缺少分號(hào)
127: xxx declared but never used — 說(shuō)明了xxx但沒(méi)有使用
128: xxx is assigned a value which is never used — 給xxx賦了值但未用過(guò)
網(wǎng)站欄目:c語(yǔ)言所有函數(shù)錯(cuò)誤 c語(yǔ)言函數(shù)程序設(shè)計(jì)常見錯(cuò)誤
本文路徑:http://chinadenli.net/article34/dodshpe.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供、品牌網(wǎng)站設(shè)計(jì)、App開發(fā)、軟件開發(fā)、網(wǎng)站維護(hù)、網(wǎng)站改版
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)