๐Ÿ’ป Dev & CSC++ Programming

C++ Programming Ch.2 Exercise 10 Solution

Problem: ๋ฌธ์ž์—ด์„ ํ•˜๋‚˜ ์ž…๋ ฅ๋ฐ›๊ณ  ๋ฌธ์ž์—ด์˜ ๋ถ€๋ถ„ ๋ฌธ์ž์—ด์„ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜๋ผ. ์˜ˆ์‹œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค. Objective & Hints: ๋ฌธ์ž์—ด ์ฝ๊ธฐ, ๋ฌธ์ž์—ด ๋‹ค๋ฃจ๊ธฐ Execution Result: Code: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 #include using namespace std; int main() { cout << "๋ฌธ์ž์—ด ์ž…๋ ฅ>>"; char str[100]; cin.getline(str,100); for(int i=1;i<100;i++){ for(int j=0;j<i;j++) { cout << str[j]; } if(str[i]=='\0') // ๋ฌธ์ž์—ด์˜ ๋์ด๋ฉด break break; cout << endl; } return 0; }

February 28, 2020 ยท 1 min ยท Sobamemil