我的if else語句中出現以下錯誤。語法有什麼問題?if語句中的C++錯誤,我的語法有什麼問題?
ass4.cpp:46:錯誤:無法轉換 '的std :: string' 到 '廉政' 的回報 ass4.cpp:49:錯誤:預期 '(' 前 '其他'
41 if ((type_f == 1) && (type_s == 1))
42 {
43 cout << "11" << endl;
44
45 // 1 1 = iterative, reverse
46 return reverse(str_input);
47 }
48
49 if else((type_f == 1) && (type_s == 2))
50 {
51 cout << "12" << endl;
52
53 return palin_l(str_input);
54 }
我們在這裏需要更多的上下文。你能發佈一個完整的,自包含的例子,讓我們得到錯誤嗎? – templatetypedef
好吧,顯然,你要返回一個字符串而不是int。 – chris
,你可能的意思是'else if'而不是'if else' – rici