回答編集履歴

1

SetConsoleCursorPosition のコードを追加

2020/05/22 05:00

投稿

kazuma-s
kazuma-s

スコア8224

test CHANGED
@@ -59,3 +59,61 @@
59
59
  }
60
60
 
61
61
  ```
62
+
63
+
64
+
65
+ **追記**
66
+
67
+ ```C
68
+
69
+ #include <windows.h>
70
+
71
+ #include <stdio.h>
72
+
73
+ #include <stdlib.h> // system
74
+
75
+
76
+
77
+ int main(void)
78
+
79
+ {
80
+
81
+ system("cls");
82
+
83
+
84
+
85
+ HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
86
+
87
+ puts("1. apple \n" "2. orange\n" "3. grape ");
88
+
89
+ Sleep(2000);
90
+
91
+
92
+
93
+ COORD coord = { 0, 1 };
94
+
95
+ SetConsoleCursorPosition(h, coord);
96
+
97
+ puts("5. banana");
98
+
99
+ Sleep(2000);
100
+
101
+
102
+
103
+ coord.Y = 0;
104
+
105
+ SetConsoleCursorPosition(h, coord);
106
+
107
+ puts("7. peach ");
108
+
109
+ Sleep(2000);
110
+
111
+
112
+
113
+ coord.Y = 3;
114
+
115
+ SetConsoleCursorPosition(h, coord);
116
+
117
+ }
118
+
119
+ ```