Advertisement
rfmonk

sine_print.c

Mar 8th, 2014
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <string.h>
  4.  
  5. int main()
  6. {
  7.     int i;
  8.     int offset;
  9.     char sinstr[80];
  10.  
  11.     memset(sinstr,0x20, 80);
  12.     sinstr[79] = '\0';
  13.  
  14.     for (i = 0; i < 20; i++) {
  15.         offset = 39 + (int)(39 * sin(M_PI * (float) i/10)):
  16.  
  17.         sinstr[offset] = '*';
  18.         printf("%s\n", sinstr);
  19.         sinstr[offset] = ' ';
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement