U E D R , A S I H C RSS

장용운/알파벳놀이

#include <iostream>
using std::cout;
using std::cin;
using std::endl;

void draw(char, char);

int main(void) {
	char a, b;

	cin>>a>>b;

	draw(a, b);

	return 0;
}


void draw(char begin, char end) {
	for(int i=0; i<= (end-begin); i++) {
		for(int j=0; j<=i; j++) {
			cout<<(char)(begin+j);
		}
		cout<<endl;
	}
}

심심하군요

실행 결과

Input:
AZ

Output:
A
AB
ABC
ABCD
ABCDE
ABCDEF
ABCDEFG
ABCDEFGH
ABCDEFGHI
ABCDEFGHIJ
ABCDEFGHIJK
ABCDEFGHIJKL
ABCDEFGHIJKLM
ABCDEFGHIJKLMN
ABCDEFGHIJKLMNO
ABCDEFGHIJKLMNOP
ABCDEFGHIJKLMNOPQ
ABCDEFGHIJKLMNOPQR
ABCDEFGHIJKLMNOPQRS
ABCDEFGHIJKLMNOPQRST
ABCDEFGHIJKLMNOPQRSTU
ABCDEFGHIJKLMNOPQRSTUV
ABCDEFGHIJKLMNOPQRSTUVW
ABCDEFGHIJKLMNOPQRSTUVWX
ABCDEFGHIJKLMNOPQRSTUVWXY
ABCDEFGHIJKLMNOPQRSTUVWXYZ


Input:
cq

Output:
c
cd
cde
cdef
cdefg
cdefgh
cdefghi
cdefghij
cdefghijk
cdefghijkl
cdefghijklm
cdefghijklmn
cdefghijklmno
cdefghijklmnop
cdefghijklmnopq


Input:
39

Output:
3
34
345
3456
34567
345678
3456789


Input:
98

Output:
(없음)


덧글


  • 아 잉여하다 - 장용운
    • 왓더, 아웃풋이 멋지군. 나도 코드 안봤으니, 한번 해볼까 -김태진
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:30:43
Processing time 0.0239 sec