#include "config.h"
void main() {
/*if (조건식) {
조건식이 참일경우;
...;
} else {
조건식이 거짓일 경우;
...;
}*/
//int age;
//printf("input your age : ");
//scanf_s("%d", &age);
//cout << "input your age : ";
//cin >> age;
//if (age >= 19) {
// printf("You are adult, welcome.\n");
//}
//else{
// printf("You are not adult, ask our staffs.\n");
//}
// c언어는 프로그램에서 사용할 변수를 프로그램 상단에서 미리 선언하고 사용해야 했지만,
// c++부터는 변수가 필요한 순간 만들어서 사용하면 된다.
//int cpp, java, jsp;
//printf("input your scores : ");
//scanf_s("%d %d %d", &cpp, &java, &jsp);
//cout << "input your scores : ";
//cin >> cpp >> java >> jsp;
//int total = cpp+ java+ jsp;
//double average = total / 3; //정수로 나옴
//double average = total / 3.; //묵시적 형변환
//double average = (double) total / 3; //명시적 형변화
//printf("총점 : %d, 평균 : %.2f\n", total, average);
//cout << "총점 : " << total << ",평균 : " << average << endl;
//if (average >= 90) {
// printf("평균점수 %f는 %c 등급입니다.\n", average, 'A');
//}
////if (80 <= average < 90) { //파이썬에서만 되는것
//// printf("평균점수 %f는 %c 등급입니다.\n", average, 'B');
////}
////
//if (average < 90 && average >= 80) {
// printf("평균점수 %f는 %c 등급입니다.\n", average, 'B');
//}
//if (average < 80 && average >= 70) {
// printf("평균점수 %f는 %c 등급입니다.\n", average, 'C');
//}
//if (average < 70 && average >= 60) {
// printf("평균점수 %f는 %c 등급입니다.\n", average, 'D');
//}
//if (average < 60) {
// printf("평균점수 %f는 %c 등급입니다.\n", average, 'F');
//}
// else if가 if나열보다 효율이 좋다.
/*if (average >= 90) {
printf("평균점수 %f는 %c 등급입니다.\n", average, 'A');
} else if (average < 90 && average >= 80) {
printf("평균점수 %f는 %c 등급입니다.\n", average, 'B');
} else if (average < 80 && average >= 70) {
printf("평균점수 %f는 %c 등급입니다.\n", average, 'C');
} else if (average < 70 && average >= 60) {
printf("평균점수 %f는 %c 등급입니다.\n", average, 'D');
} else if (average < 60) {
printf("평균점수 %f는 %c 등급입니다.\n", average, 'F');
}*/
/*if (average >= 90) {
printf("평균점수 %f는 %c 등급입니다.\n", average, 'A');
} else if (average >= 80) {
printf("평균점수 %f는 %c 등급입니다.\n", average, 'B');
} else if (average >= 70) {
printf("평균점수 %f는 %c 등급입니다.\n", average, 'C');
} else if (average >= 60) {
printf("평균점수 %f는 %c 등급입니다.\n", average, 'D');
} else {
printf("평균점수 %f는 %c 등급입니다.\n", average, 'F');
}*/
// 연도를 입력받으세요
/*int year;
cout << "윤년인지 아닌지 판단할 연도를 입력하시오 : ";
cin >> year;*/
// 윤년, 평년 판별식
// 연도가 4로 나눠 떨어지고 100으로 나눠 떨어지거나 400으로 나눠 떨어지면 윤년, 그렇지 않으면 평년.
// and == && or == ||
// 프로그램에서 여러번 사용되는 값은 변수에 저장해서 사용하면 편리하다.
// 논리값을 기억하는 변수나 결과(리턴)값이 논리값인 함수의 이름은 "is"로 시작하는 것이 관행이다.
//bool isyear = year % 100 != 0 && year % 4 == 0 || year % 400 == 0;
// int isyear = year % 100 != 0 && year % 4 == 0 || year % 400 == 0; // c언어
/*if (year % 100 != 0 && year % 4 == 0 || year % 400 == 0) {
cout << year << "년은 윤년입니다.(1)" << endl;
}
else {
cout << year << "년은 평년입니다.(1)" << endl;
}*/
/*if (isyear) {
cout << year << "년은 윤년입니다.(1)" << endl;
}
else {
cout << year << "년은 평년입니다.(1)" << endl;
}*/
// 삼항연산자 => ?: => 간단한 if, 조건식이 참이나 거짓일 때 실행할 문장이 딱 1개 일경우 사용하면 편리하다.
// 형식 => 조건식 ? 조건식이 참일 때 실행할 문장 : 조건식이 거짓일 때 실행할 문장
// 파이썬 형식 => 조건식이 참일 때 실행할 문장 if 조건식 else 조건식이 거짓일 때 실행할 문장
/*printf("%d년은 %s년입니다.(2)\n", year, year % 100 != 0 && year % 4 == 0 || year % 400 == 0 ? "윤" : "평");
printf("%d년은 %s년입니다.(2-1)\n", year, isyear ? "윤" : "평");
cout << year << "년은 " << (year % 100 != 0 && year % 4 == 0 || year % 400 == 0 ? "윤" : "평") << "년입니다.(3)" << endl;
cout << year << "년은 " << (isyear ? "윤" : "평") << "년입니다.(3-1)" << endl;*/
}