본문 바로가기
728x90

프로그래밍 문제/C, C++ Problem3

[C/C++] 기초플러스 5장 연습문제 1. 분수로 주어지는 시간을 시간 수와 분 로 변환하는 프로그램을 작성하여라. 60을 나타내는 기호 상수를 만들기 위해 #define 또는 const를 사용하라. 사용자가 반복적으로 값을 입력할 수 있도록 while 루프를 사용하고 0또는 0보다 작은 값이 입력되면 루프를 끝낸다. #include #define Hour_to_Min 60 int main(void){ float time; printf("#####################################\n"); printf("Please, write down a time (unit: hour)\n"); printf("Example: 1.25 hour\n"); while(1){ printf("If you want to quit this pr.. 2022. 3. 4.
[C기초 플러스] 4장 연습문제 1. 먼저 이름을 요청하고 이어서 다시 성을 요청한다. 그리고 나서, 성 이름 순으로 출력하는 프로그램을 작성하라. #include #define max_words 100 int main(void){ char last_name[max_words], first_name[max_words]; printf("Please write your last name: "); scanf("%s", last_name); printf("Please write your first name: "); scanf("%s", first_name); printf("This is your name: %s %s\n", first_name, last_name); } 2. 이름을 요청하고, 그 이름을 다음과 같은 포멧으로 출력하는 프로그램을.. 2022. 2. 27.
[C 기초 플러스] 3장 연습문제 문제 2 66과 같은 ASCII 코드값을 사용자에게 입력하도록 요청하고 그 ASCII 코드값에 해당되는 문자를 출력하는 프로그램을 작성하여라 #include #include int main(void){ printf("################################################################################\n"); printf("This program will translate a number you give into a corresponding ASCII code\n"); printf("################################################################################\n"); int nu.. 2022. 2. 25.
728x90