/*****************************************************************************/ /* ECE-1011 Summer 2003 */ /* Section:......... 0 */ /* Assignment:...... 0 */ /* Programmer:...... BAHN, William L. */ /* File Contents:... SOURCE CODE */ /* Filename:........ s00_bahw.c */ /* Due Date:........ 09 JUN 03 */ /* E-mail Address:.. wbahn@eas.uccs.edu */ /*****************************************************************************/ /*****************************************************************************/ /***************************** INCLUDE FILES *********************************/ /*****************************************************************************/ #include // printf() #include // sin() /*****************************************************************************/ /********************* PROGRAMMER DEFINED CONSTANTS **************************/ /*****************************************************************************/ #define PI (3.1415926345) #define PERIOD (25) /*****************************************************************************/ /***************************** MAIN PROGRAM **********************************/ /*****************************************************************************/ int main(void) { int t, col; int y_sq, y_sine, y_tri, y_saw; t = 0; while(t < 250) { y_sine = 9 * sin( ((2*PI)/PERIOD) * t); y_saw = 9 * ((double) (t%PERIOD) / (double) PERIOD); if(sin(((2*PI)/PERIOD) * t) < 0.0) y_sq = -9; else y_sq = 9; for(col=1; col<20; col++) { if(col-10 == y_sine) printf("o"); else printf(" "); } for(col=1; col<20; col++) { if(col == 2*y_saw) printf("\\"); else printf(" "); } for(col=1; col<20; col++) { if(col-10 == y_sq) printf("|"); else printf(" "); } printf("\n"); t++; } return(0); }