Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- #include <windows.h>
- using namespace std;
- void gotoxy(int x, int y)
- {
- COORD coord;
- coord.X = x;
- coord.Y = y;
- SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
- }
- int main(int argc, char *argv[])
- {
- system("chcp 1250");
- system("cls");
- int x,y,d,srodek,a;
- cout<<"Podaj współrzędną x środka: ";
- cin>>x;
- cout<<"Podaj współrzędną y środka: ";
- cin>>y;
- cout<<"Podaj długość lini: ";
- cin>>d;
- srodek=d%2;
- a=x-(d/2);
- gotoxy(a,y);
- for (int i=0;i<d ;i++)
- {
- cout<<"-";
- }
- gotoxy(x,y);
- cout<<"0";
- cout<<endl;
- system("PAUSE");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement