Advertisement
dantepw

Untitled

Jul 29th, 2014
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <windows.h> //usado com o gotoxy
  3.  
  4. void gotoxy(); //declarando a função gotoxy
  5.  
  6. int main (){
  7.  
  8. gotoxy(15, 10); //15 equivale ao X, que é horizontal. 10 equivale ao Y, que é vertical.
  9. //você pode usar variáveis ao invés de números tb para facilitar!
  10. printf("Teste!!");
  11.  
  12. getch();
  13. //EXEMPLO USANDO COM VARIÁVEIS
  14. system("cls");
  15. int i, y, x;
  16.  
  17. x = 5, y = 5;
  18. for (i = 0; i < 20; i++){
  19. gotoxy(x, y);
  20. Sleep(200);
  21. printf("Testando!!");
  22. x += 1;
  23. }
  24.  
  25. return 0;
  26.  
  27. }
  28.  
  29. void gotoxy(x, y){
  30.  
  31. HANDLE k = GetStdHandle (STD_OUTPUT_HANDLE);
  32. COORD position = {x, y};
  33. SetConsoleCursorPosition (k, position);
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement