C++函数和'标识符未找到'错误

Era*_*ray 1 c++

我是一名C++学习者.我正在尝试编写一个基本的C++项目.这是基本的自动化系统.它有一个导航菜单.

Choose an option :
   1 ) Add a new customer
   2 ) List all customers
   ...
Run Code Online (Sandbox Code Playgroud)

将有一个nav包含用户选择的变量.这是我的源代码:

#include <stdio.h>
#include <clocale>

int nav;    

void main()
{
    setlocale(LC_ALL,"turkish");
    navigasyon();
    switch (nav) // checking 'nav' variable which assigned in navigasyon()
    case "1" :
         printf("Now you are adding a new customer");
    break;
    case "2" :
         printf("Now you are listing all customers");
    break;
}

void navigasyon()
{
    printf("Choose an option \n");
printf("1 ) Add a new customer\n");
printf("2 ) List all customers\n");

scanf("%d", &nav); // assigning '`nav' variable
}
Run Code Online (Sandbox Code Playgroud)

很快,在main()中,navigasyon()将显示导航菜单,用户选择1或2,然后navigasyon()将其分配给nav.最后检查nav开关盒.

但我得到'navigasyon': identifier not found错误.

kol*_*kol 8

你应该navigasyon在之前申报main.