
Сообщение от
mital25
я запутался(((
Весело.
Распутываем по поводу Goto.
C++ |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
| #include <iostream>
#include <Windows.h>
using namespace std;
void GotoXY( int column, int line )
{ COORD coord;
coord.X = column;
coord.Y = line;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),
coord
);
}
int WhereX()
{ CONSOLE_SCREEN_BUFFER_INFO csbi;
if (!GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi ))
return -1;
return csbi.dwCursorPosition.X;
}
int WhereY()
{ CONSOLE_SCREEN_BUFFER_INFO csbi;
if (!GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi))
return -1;
return csbi.dwCursorPosition.Y;
}
int main ()
{ int a,b;
int x, y;
cout << "a = ";
x = WhereX() + 10;
cin >> a;
y = WhereY() - 1;
GotoXY (x,y);
cout << "b = ";
cin >> b;
cout << "a + b = " << a+b;
cin.sync();
cin.get();
return 0;
} |
|