Hi,
I am a new user to C programming, and have worked with various examples and come right with them.
However I do not understand something with the #include command between DevC++ and Arduino C++.
I get the following error message when I compile in Arduino C++.
sketch_jun19a.ino: In function 'int main()':
sketch_jun19a:10: error: 'system' was not declared in this scope
sketch_jun19a:18: error: 'getche' was not declared in this scope
sketch_jun19a:36: error: 'getch' was not declared in this scope
However in DevC++ it works fine.
I tried also to add in the 3 .h files in to the Arduino Compiler and it gives me even more error messages.
The code I am working with is:-
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int main ( void )
{
int choice=0;
while(choice!='4')
{
system("CLS");
printf("\n\tMENU DEMONSTRATION");
printf("\n\t------------------------------");
printf("\n\n\t 1. OPTION 1");
printf("\n\t 2. OPTION 2");
printf("\n\t 3. OPTION 3");
printf("\n\t 4. EXIT");
printf("\n\n Enter Your Choice: ");
choice = getche();
switch(choice)
{
case '1':
printf("\n\nYOU SELECTED OPTION 1\n");
break;
case '2':
printf("\n\nYOU SELECTED OPTION 2\n");
break;
case '3':
printf("\n\nYOU SELECTED OPTION 3\n");
break;
case '4':
printf("\n\nYOU SELECTED OPTION 4\n");
break;
default:
printf("\n\nINVALID SELECTION...Please try again\n");
}
(void)getch();
}
return 0;
}
Thank You for any help.
Adrian.