Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <iostream>
  3. #include <windows.h>
  4.  
  5. using namespace std;
  6. void gotoxy(int x, int y)
  7. {
  8. COORD coord;
  9. coord.X = x;
  10. coord.Y = y;
  11. SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
  12. }
  13. int main(int argc, char *argv[])
  14. {
  15. system("chcp 1250");
  16. system("cls");
  17.  
  18. int x,y,d,srodek,a;
  19.  
  20. cout<<"Podaj współrzędną x środka: ";
  21. cin>>x;
  22. cout<<"Podaj współrzędną y środka: ";
  23. cin>>y;
  24. cout<<"Podaj długość lini: ";
  25. cin>>d;
  26.  
  27. srodek=d%2;
  28. a=x-(d/2);
  29.  
  30. gotoxy(a,y);
  31.  
  32. for (int i=0;i<d ;i++)
  33. {
  34. cout<<"-";
  35.  
  36. }
  37. gotoxy(x,y);
  38. cout<<"0";
  39.  
  40. cout<<endl;
  41. system("PAUSE");
  42. return EXIT_SUCCESS;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement