posted by REDFORCE 2017. 6. 14. 13:52



좌에서 우로 우에서 좌로 하나씩 증가/감소 하면서 별 찍는 간단한 코드 입니다.


요즘 뭔가 어디서쓸만한 짤방없나 계속 찾아보고있는데


마음에드는게 없네요...(시무룩)


#include <iostream>
using namespace std;
int main() {
char* ptr = "*****";
char* ptr2 = " ";
for (int i = 0; i < 5; i++) {
cout << ptr + i << endl;
}
for (int i = 0; i < 5; i++) {
cout << ptr + 4 - i << endl;
}
for (int i = 0; i < 5; i++) {
if (i > 0) cout << ptr2 + 5 - i << ptr + i << endl;
else cout << ptr << endl;
}
for (int i = 0; i < 5; i++) {
if(i > 0) cout << ptr2 + i+1 << ptr + 4 - i<< endl;
}
return 0;
}
view raw main.cpp hosted with ❤ by GitHub


'Programming > C++' 카테고리의 다른 글

[C++]간단한 배팅 도박게임  (0) 2017.06.14
[C++]간단한 숫자 퍼즐 게임  (0) 2017.06.14
[C++]Console Bingo(빙고)  (1) 2017.06.14
[C++]주민등록번호 생성기  (0) 2017.06.14
[C++]문자열 거꾸로 만들기  (0) 2017.06.14