diff --git a/jpole.c b/jpole.c index 86bd58b..3ad159f 100644 --- a/jpole.c +++ b/jpole.c @@ -2,7 +2,6 @@ #include "jpole.h" - void jpole_calc(float *f, float *unit_factor, float *lambda, float *l1, float *l2, float *l3, float *l4, float *raddiam){ *lambda = ( 29971000 / *f ) / 100; *l1 = (0.96 * *lambda * 0.75) * *unit_factor; @@ -45,4 +44,4 @@ void jpole_print(float *f, float *unit_factor, float *lambda, float *l1, float * printf("\n"); printf("\n"); printf("\n"); -} + } diff --git a/main.c b/main.c index b876c12..ae66626 100644 --- a/main.c +++ b/main.c @@ -20,7 +20,7 @@ along with this program. If not, see . //#include void clear_scr(void){ - //printf("\033[H"); //brings cursor home + printf("\033[H"); //brings cursor home printf("\x1b[2J"); //clears screen } @@ -31,7 +31,23 @@ void printunit (int *unit_index){ // prints the selected unit } } +void myflush ( FILE *in ) +{ + int ch; + do + ch = fgetc ( in ); + while ( ch != EOF && ch != '\n' ); + + clearerr ( in ); +} + +void mypause ( void ) +{ + printf ( "Press [Enter] to continue . . ." ); + fflush ( stdout ); + getchar(); +} void set_freq(float *f){ // change the MHz float input; @@ -105,14 +121,20 @@ int main(){ case 3: clear_scr(); jpole_calc(&f, &unit_factor,&lambda, &l1, &l2, &l3, &l4, &raddiam); jpole_print(&f ,&unit_factor, &lambda, &l1, &l2, &l3, &l4, &raddiam, &unit_index); + myflush ( stdin ); + mypause(); break; case 4: clear_scr(); gp_calc(&f, &unit_factor,&lambda, &l1, &l2); - gp_print(&f ,&unit_factor, &lambda, &l1, &l2, &unit_index); + gp_print(&f ,&unit_factor, &lambda, &l1, &l2, &unit_index); + myflush ( stdin ); + mypause(); break; case 5: clear_scr(); hb9cv_calc(&f ,&unit_factor, &lambda, &l1, &l2, &l3, &l4, &l5, &bdiam, &raddiam); hb9cv_print(&f ,&unit_factor, &lambda, &l1, &l2, &l3, &l4, &l5, &bdiam, &raddiam, &unit_index); + myflush ( stdin ); + mypause(); break; // default: maybe easteregg in future }