Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- using namespace System;
- using namespace std;
- int x1 = 10, y1 = 10;
- int x2= 50 , y2 = 15;
- int x3 = 100, y3 = 4;
- bool a = false;
- bool b = false;
- bool c = false;
- int da = 1;
- int db = 1;
- int dxc = 1, dyc = 1;
- void dibujar() {
- Console::SetCursorPosition(x1, y1);
- cout << "*";
- Console::SetCursorPosition(x2, y2);
- cout << "*";
- Console::SetCursorPosition(x3, y3);
- cout << "*";
- }
- void actualizar() {
- if (a) {
- y1 += da;
- if (y1 == 0 || y1 == 15) da *= -1;
- }
- if (b) {
- x2 += db;
- if (x2 == 0 || x2 == 115) db *= -1;
- }
- if (c) {
- x3 += dxc;
- y3 += dyc;
- if (y3 == 0 || y3 == 15) dyc *= -1;
- if (x3 == 0 || x3 == 115) dxc *= -1;
- }
- }
- void borrar() {
- Console::SetCursorPosition(x1, y1);
- cout << " ";
- Console::SetCursorPosition(x2, y2);
- cout << " ";
- Console::SetCursorPosition(x3, y3);
- cout << " ";
- }
- int main()
- {
- while (1) {
- borrar();
- actualizar();
- dibujar();
- _sleep(50);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement