Palhota Posted May 16, 2023 at 03:19 PM Report Share #630956 Posted May 16, 2023 at 03:19 PM Este é um código que encontrei e tentei adaptar mas a "animação" está demasiado rápida para se perceber. #include <stdio.h> //Giving some delay void delay( unsigned int value) { unsigned int count1 =10; unsigned int count2 =10; for(count1 = 10; count1 < value ; count1++ ) { for(count2 = 10; count2 < count1 ; count2++ ) { } } } // string to display Rocket const char rocket[] =R"EOF( _____ _____ _____ /\ \ /\ \ /\ \ /::\ \ /::\ \ /::\ \ \:::\ \ \:::\ \ /::::\ \ \:::\ \ \:::\ \ /::::::\ \ \:::\ \ \:::\ \ /:::/\:::\ \ \:::\ \ \:::\ \ /:::/ \:::\ \ /::::\ \ /::::\ \ /:::/ \:::\ \ /::::::\ \ ____ /::::::\ \ /:::/ / \:::\ \ /:::/\:::\ \ /\ \ /:::/\:::\ \ /:::/ / \:::\ \ /:::/ \:::\____\/::\ \/:::/ \:::\____\/:::/____/ \:::\____\ /:::/ \::/ /\:::\ /:::/ \::/ /\:::\ \ \::/ / /:::/ / \/____/ \:::\/:::/ / \/____/ \:::\ \ \/____/ /:::/ / \::::::/ / \:::\ \ /:::/ / \::::/____/ \:::\ \ \::/ / \:::\ \ \:::\ \ \/____/ \:::\ \ \:::\ \ \:::\ \ \:::\ \ \:::\____\ \:::\____\ \::/ / \::/ / \/____/ \/____/ )EOF"; const char rocket1[] =R"EOF( _____ _____ _____ /\ \ /\ \ /\ \ /::\ \ /::\ \ /::\ \ \:::\ \ /::::\ \ /::::\ \ \:::\ \ /::::::\ \ /::::::\ \ \:::\ \ /:::/\:::\ \ /:::/\:::\ \ \:::\ \ /:::/__\:::\ \ /:::/ \:::\ \ /::::\ \ /::::\ \:::\ \ /:::/ \:::\ \ /::::::\ \ /::::::\ \:::\ \ /:::/ / \:::\ \ /:::/\:::\ \ /:::/\:::\ \:::\ \ /:::/ / \:::\ \ /:::/ \:::\____\/:::/ \:::\ \:::\____\/:::/____/ \:::\____\ /:::/ \::/ /\::/ \:::\ /:::/ /\:::\ \ \::/ / /:::/ / \/____/ \/____/ \:::\/:::/ / \:::\ \ \/____/ /:::/ / \::::::/ / \:::\ \ /:::/ / \::::/ / \:::\ \ \::/ / /:::/ / \:::\ \ \/____/ /:::/ / \:::\ \ /:::/ / \:::\ \ /:::/ / \:::\____\ \::/ / \::/ / \/____/ \/____/ )EOF"; const char rocket2[] =R"EOF( _____ _______ _____ /\ \ /::\ \ /\ \ /::\ \ /::::\ \ /::\ \ \:::\ \ /::::::\ \ /::::\ \ \:::\ \ /::::::::\ \ /::::::\ \ \:::\ \ /:::/~~\:::\ \ /:::/\:::\ \ \:::\ \ /:::/ \:::\ \ /:::/__\:::\ \ /::::\ \ /:::/ / \:::\ \ /::::\ \:::\ \ /::::::\ \ /:::/____/ \:::\____\ /::::::\ \:::\ \ /:::/\:::\ \ |:::| | |:::| | /:::/\:::\ \:::\ \ /:::/ \:::\____\|:::|____| |:::| |/:::/__\:::\ \:::\____\ /:::/ \::/ / \:::\ \ /:::/ / \:::\ \:::\ \::/ / /:::/ / \/____/ \:::\ \ /:::/ / \:::\ \:::\ \/____/ /:::/ / \:::\ /:::/ / \:::\ \:::\ \ /:::/ / \:::\__/:::/ / \:::\ \:::\____\ \::/ / \::::::::/ / \:::\ \::/ / \/____/ \::::::/ / \:::\ \/____/ \::::/ / \:::\ \ \::/____/ \:::\____\ ~~ \::/ / \/____/ )EOF" ; int main() { int jumpControlAtBottom = 0; const int someDelay = 16000; int shifControl = 0; //jump to bottom of console for (jumpControlAtBottom = 0; jumpControlAtBottom < 30; ++jumpControlAtBottom) { printf("\n"); } //Print rocket fputs(rocket,stdout); fputs(rocket1, stdout); fputs(rocket2, stdout); for (shifControl = 0; shifControl < 30; ++shifControl) { // Rocket move on the basis of delay delay(someDelay); // move rocket a line upward printf("\n"); } return 0; } Link to comment Share on other sites More sharing options...
thoga31 Posted May 18, 2023 at 11:31 AM Report Share #630979 Posted May 18, 2023 at 11:31 AM Será algo assim que pretendes fazer? #include <unistd.h> /* strings "rocket" aqui */ #define DIM 3 const char *animation[DIM] = {rocket, rocket1, rocket2}; int main(void) { for (int i = 0; i < DIM; i++) { printf("%s\n", animation[i]); sleep(1); } return 0; } O delay é de 1 segundo. Knowledge is free! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now