我是一名C++學習者。我試圖編寫一個基本的C++項目。這是基本的自動化系統。它有一個導航菜單。C++函數和'identifier not found'錯誤
Choose an option :
1) Add a new customer
2) List all customers
...
將會有一個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
}
在不久 在main(),navigasyon()將顯示導航菜單,用戶選擇1或2,然後navigasyon()它assinging到nav
。最後用switch-case檢查nav
。
但我得到'navigasyon': identifier not found
錯誤。
[函數原型](http://en.wikipedia.org/wiki/Function_prototype) – 2011-12-17 22:37:10
除#include'我在這裏沒有看到任何C++。 –
n0rd
2011-12-17 22:39:39