Tedd OKANO
/
RPN_calc__based_on_K_and_R
just a sample of what can be done
Embed:
(wiki syntax)
Show/hide line numbers
getop.cpp
00001 #include "mbed.h" 00002 #include "calc.h" 00003 #include <ctype.h> 00004 00005 int getop( char s[] ) 00006 { 00007 int i, c; 00008 00009 while ( (s[ 0 ] = c = getch()) == ' ' || c == '\t' ) 00010 ; 00011 00012 s[ 1 ] = '\0'; 00013 00014 if ( !isdigit( c ) && c != '.' ) 00015 return c; 00016 00017 i = 0; 00018 00019 if ( isdigit( c ) ) 00020 while ( isdigit( s[ ++i ] = c = getch() ) ) 00021 ; 00022 00023 if ( c == '.' ) 00024 while ( isdigit( s[ ++i ] = c = getch() ) ) 00025 ; 00026 00027 s[ i ] = '\0'; 00028 00029 00030 if ( c != EOF ) 00031 ungetch( c ); 00032 00033 return NUMBER; 00034 }
Generated on Sat Jul 30 2022 02:03:38 by 1.7.2