전체 글(287)
-
[C++] 15. sizeof()
#include using namespace std; void main() { int num = 10; //sizeof(크기를측정하고싶은것) cout
2022.05.31 -
[C++] 다중for문을 써서 별을 찍어보자
#include using namespace std; void main() { cout
2022.05.31 -
[C++] 조건문을 써서 데미지 공식을 만들어보자
#include using namespace std; void main() { float damage = 16; int atk = 5; int def = 5; int dex = 5; int spd = 2; int mag = 2; int res = 4; float resultDamage; resultDamage = damage + (atk + def + dex) * 2 - (spd + mag + res) / 2; if (resultDamage > 40) { cout
2022.05.30 -
[C++] 14. 배열
#include using namespace std; void main() { int scoreA = 70; int scoreB = 20; int scoreC = 90; int scoreD = 0; int scoreE = 80; // 배열 // index라는 개념이 있기때문에 바로 바로 참조 가능 int scores[] = { 70, 20, 90, 0, 80 }; int maxValue = 0; int maxIndex = 0; //sizeof cout
2022.05.30 -
[C++] 13. 포인터변수
#include using namespace std; void main() { int num = 10; // 포인터변수 : 주소를 담는 변수 cout
2022.05.30 -
[C++] 12. 피보나치 수열 문제
// F0 = 0 // F1 = 1 // F2 = 1 // F3 = 2 // F4 = 3 // F5 = 5 // F6 = 8 // F7 = 13 int Fibo(int value) { if (value == 0) { return 0; } if (value == 1 || value == 2) { return 1; } return Fibo(value - 1) + Fibo(value - 2); } void main() { cout
2022.05.30