More actions
imported>csm5327 No edit summary |
imported>ih92sh No edit summary |
||
| Line 138: | Line 138: | ||
=== 이재형 === | === 이재형 === | ||
#include <stdio.h> | #include <stdio.h> | ||
int main(void) | |||
{ | |||
int n, a, b, c; | |||
a=1, b=0, c=0; | |||
scanf("%d", &n); | |||
while (a<=n) { | |||
printf("\n"); | |||
while(c<n) { | |||
printf(" "); | |||
c++;} | |||
b=0; | |||
while(b<2*a-1){ | |||
printf("*"); | |||
b++;} | |||
c=a; | |||
a++; | |||
} | |||
getch(); | |||
return 0; | |||
} | |||
=== 최승민 === | === 최승민 === | ||
Revision as of 05:34, 8 April 2012
- 4월 4일 7시 30분 - 9시
출석
| 선생님 | 강성현 | O |
| 학생 | 이재형 | O |
| 최승민 | O |
수업내용
별찍기 도전
1차 목표
* ** *** **** *** ** *
- 자신이 짠 소스를 올려주세요.
이재형
#include <stdio.h>
#include <conio.h>
int main(void)
{
int a,b,c;
int d,e,f ;
a=1;
c=1;
d=0;
scanf("%d", &b);
e=b;
f=1;
while (a<b)
{
c=1;
d=0;
printf("\n");
while (d<f)
{
printf("*");
c++;
d++;
}
f++;
a++;
}
a=0;
c=1;
d=0;
while (a<e)
{
c=1;
d=0;
printf("\n");
while (d<b)
{
printf("*");
c++;
d++;
}
a++;
b--;
}
_getch();
return 0;
}
최승민
#include <stdio.h>
#include<stdio.h>
int main()
{
int a, b, c;
scanf("%d",&c);
for(a=1;a<2*c;a++){
if(a<=c){
for(b=1;b<=a;b++)
printf("*");
printf("\n");
}
else {
for(b=2*c-a;b>=1;b--)
printf("*");
printf("\n");
}
}
return 0;
}
후기
별만들기 후기
오늘 손봉수 교수님의 수업을 듣고 제대로 이해하지 못하였었던 별만들기 수업을 다시 해보니 어렵다는 것도 깨닫았고 또 별만들기를 직접 해보니 더 이해도 잘 된것 같던 것 같습니다. 역시 씨는 직접 해보는게 최고인것 같습니다. ㅋㅋㅋㅋㅋㅋㅋㅎㅎㅎㅎ
과제
- 2차 목표
3 (<- scanf로 입력) * *** *****
- Hint!
- 공백을 출력하는 반복문과 *을 출력하는 반복문 2개를 사용하여 한 줄을 만든다.
- 각 줄에서 공백을 출력하는 횟수와 *을 출력하는 횟수의 규칙을 찾아내어 식을 만들고 이를 조건식으로 활용한다.
이재형
#include <stdio.h>
int main(void)
{
int n, a, b, c;
a=1, b=0, c=0;
scanf("%d", &n);
while (a<=n) {
printf("\n");
while(c<n) {
printf(" ");
c++;}
b=0;
while(b<2*a-1){
printf("*");
b++;}
c=a;
a++;
}
getch();
return 0;
}
최승민
#include <stdio.h>
#include<stdio.h>
int main(){
int a, b, n;
scanf("%d",&n);
for(a=1;a<=n;a++){
for(b=n;b>a;b--)
printf(" ");
for(b=1;b<=2*a-1;b++)
printf("*");
printf("\n");
}
return 0;
}
- 3차 목표
3 (<- scanf로 입력) * *** ***** *** *
이재형
#include <stdio.h>
최승민
#include <stdio.h>