[英]What does this mean: a function-definition is not allowed here before '{' token
我的問題出在下面的 C++ 行中,但我就是想不通。
[錯誤] 此處不允許在 '{' 標記之前定義函數
#include <cstdlib>
#include <iostream>
#include<iomanip>
#include<fstream>
#include<cstring>
using namespace std;
int main() {
void displaymenu(){
cout<<"MENU"<<"\n";
}
displaymenu();
system("pause");
return 0;
}
不允許局部函數定義,更改:
int main() {
void displaymenu(){
}
}
對此,
void displaymenu(){
// ...
}
int main() {
// ...
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.