Pushok icon

Writing text with sinusoid style

Pushok | PRO | 04/18/11 01:18:07 PM UTC | 0 ⭐ | 396 👁️ | Never ⏰ | []
C |

400 B

|

None

|

0 👍

/

0 👎

#include "stdio.h"
#include "stdlib.h"
#include "conio.h"
#include "cmath"
#include "windows.h"
 
void gotoxy(int x, int y)
{
    COORD crd = {x,y};
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), crd);
}
 
int main()
{
    char* s = "I like C++ very much!";
    for(double i=0, mi = 30;i<(double)strlen(s);i++)
    {
        gotoxy(i*3, -sin(i)*2 + mi);
        putc(s[int(i)], stdout);
    }
    getch();
}

Comments