[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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#include <iostream>
using namespace std;
int main()
{
#pragma region 별찍기1
int input;
cin >> input;
for (int i = 0; i < input; i++)
{
for (int j = 0; j < input; j++)
{
cout << "*";
}
cout << endl;
}
#pragma endregion
#pragma region 별찍기2
int input;
cin >> input;
for (int i = 0; i < input; i++)
{
for (int j = 0; j < i + 1; j++)
{
cout << "*";
}
cout << endl;
}
#pragma endregion
#pragma region 별찍기3
int input;
cin >> input;
for (int i = 0; i < input; i++)
{
for (int j = 0; j < input - i; j++)
{
cout << "*";
}
cout << endl;
}
#pragma endregion
#pragma region 구구단
int input;
cin >> input;
for (int i = 2; i < input+1; i++)
{
for (int j = 1; j < 10; j++)
{
cout << i << " * " << j << " = " << i * j << endl;
}
cout << endl;
}
#pragma endregion
}
|
cs |




'⭐ Programming > C++' 카테고리의 다른 글
[C++] Enumeration 열거형 (0) | 2022.03.20 |
---|---|
[C++] 가위 바위 보 (0) | 2022.03.20 |
[C++] while, for 반복문 (0) | 2022.03.20 |
[C++] if, if-else, else, switch 분기문 (0) | 2022.03.20 |
[C++] 변수의 유효범위, 연산 우선순위, 타입 변환, 사칙연산 주의사항 (0) | 2022.03.20 |
댓글
이 글 공유하기
다른 글
-
[C++] Enumeration 열거형
[C++] Enumeration 열거형
2022.03.20Enum - 숫자를 지정 안 하면 첫 값은 0 - 그 다음 값들은 '이전 값 + 1' - 아래의 경우 첫 번째 값인 ENUM_SCISSORS = 1로 설정하면 그 뒤에 값은 2, 3 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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 … -
[C++] 가위 바위 보
[C++] 가위 바위 보
2022.03.201 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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 #include using namespace std; const int SCISSORS = 1; const int ROCK = 2; const int PAPER … -
[C++] while, for 반복문
[C++] while, for 반복문
2022.03.201 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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 #include using namespace std; // 반복문 // 데이터를 메모리에 할당하고 가공하고 방법에 대해 알아봄 // … -
[C++] if, if-else, else, switch 분기문
[C++] if, if-else, else, switch 분기문
2022.03.20분기문 인프런 Rookiss님의 'Part1: C++ 프로그래밍 입문' 강의를 기반으로 정리한 필기입니다. 😎[C++과 언리얼로 만드는 MMORPG 게임 개발 시리즈] Part1: C++ 프로그래밍 입문 강의 들으러 가기! 분기문 데이터를 메모리에 할당하고 가공하고 방법에 대해 알아봄 가공한 데이터를 이용해서 무엇인가를 하고 싶다면? 예시 1 더보기 #include using namespace std; int main() { int hp = 100; // 몬스터 HP int damage = 90; // 플레이어 데미지 hp -= damage; // 피격 판정 bool isDead = (hp
댓글을 사용할 수 없습니다.