c++6 개념과 핵심원리로 배우는 C++ 프로그래밍 4장 프로그래밍 문제 1. if~else를 이용하여 입력받은 정수의 짝/홀수 여부를 출력하는 프로그램을 작성하시오. #include using namespace std; int main(void){ int num; while(true){ cout > num; if(num == 0){ cout 2023. 10. 31. 개념과 핵심원리로 배우는 C++ 프로그래밍 3장 프로그래밍 문제 1. 삼항 연산자를 이용하여 입력받은 정수의 짝수, 홀수 여부를 출력하는 프로그램을 작성하시오. #include #include using namespace std; string evenodd(int num){ string even = "짝수"; string odd = "홀수"; return num % 2 == 0 ? even : odd; } int main (void){ int num; while(true){ cout > num; if(num == 0){ cout 2023. 10. 31. 이전 1 2 다음