06/07/05 수업내용

DEVELOP/C 2006. 7. 5. 14:55

char ch;
sizeof ch
sizeof 'A'


6장

// %[flag][width][.precisioin][modifier]변환문자
//매핑문자or정렬방식/공간확보/소수점길이설정/
//flag : #, 0, -
printf("%#o",a);
printf("%9o",a);
printf("%-o",a);




제어문
선택문 : if, switch~case
반복문 : do~while, while, for
분기문 : break, continue, goto, return

if문

관계연산자
<, <=, >, >=, ==, !=

논리연산자
and, or, not
&&, ||, !

short circuit기능

a>10 && a<20
-> 1 && 0
-> 0


#include <stdio.h>

int main()
{
int hakjeom;
scanf("%d",&hakjeom);
// double a,b, res=0;
// scanf("%lf%lf",&a,&b);
// res=a/(b*b);

// if (res>=20 && res<25) printf("100만불짜리 몸매");
// if (res<20 || res>=25) printf("헬스장좀 댕겨라");

// if (res>=25) printf("%lf\t과체중",res);
// else if (res>=20) printf("%lf\t표준체중",res);
// else if (res<20) printf("%lf\t저체중",res);

// if (res>=20 && res<25) printf("100만불짜리 몸매");
// else if (res<20) printf("%lf\t저체중",res);
// else if (res>=25) printf("%lf\t과체중",res);

if (hakjeom >= 90) printf("A\t");
else if (hakjeom >= 80) printf("B\t");
else if (hakjeom >= 70) printf("C\t");
else printf("F\t");

return 0;
}

AND