목록분류 전체보기 (313)
printf("ho_tari\n");
#include int main(void) { int year; scanf("%d", &year); //int isLeap = (year % 4 == 0 && year % 100 != 0 || year % 400 == 0); //int isLeap = (year % 400 == 0 || year % 4 == 0 && year % 100 != 0); //printf("%d is leap : %d\n", year, isLeap); if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) { printf("%d is a leap year\n", year); } else { printf("%d is an ordinary year\n", year); } return 0..
#include #include "string.h" int main() { String s1; String s2 = "hello, world"; // String s2("hello, world"); //String s2 = 0; String s3 = s2; // String s3(s2); s1 = s2; // s1 = s1; // self assignment?? s1 = "hello, "; // String tmp("hello, "); s1 = tmp; tmp.~String(); String s4 = " IoT"; s1 = s2 + s4; if (s1 == s2) { std::cout str, rhs.str) == 0; } bool String::operator!=(const String& rhs) co..
#include int main(void) { int num; printf("input num : "); scanf("%d", &num); //int isOdd = (num % 2 == 1); //int isEven = (num % 2 == 0); //printf("%d is odd : %d\n", num, isOdd); if (num % 2 /* == 1*/) { printf("%d is odd\n", num); } else { printf("%d is even\n", num); } return 0; } #include int main(void) { int num; printf("input num : "); scanf("%d", &num); //int isOdd = (num % 2 == 1); //in..
#include int main(void) { printf("Name: hotari\nPhone: 010-####-****\nE-mail: ericsungho@naver.com\n"); return 0; }
#include int main(void) { int a, b, c; printf("input 3 num : "); scanf("%d %d %d", &a, &b, &c); int max, mid, min; max = a; if (b > max) { max = b; } if (c > max) { max = c; } min = a; if (b < min) { min = b; } if (c < min) { min = c; } mid = a + b + c - max - min; printf("max : %d\nmid : %d\nmin : %d\n", max, mid, min); return 0; } #include int main(void) { int a, b, c; scanf("%d %d %d", &a, &b..
#include #include #include #define lotto_max 45 #define lotto_num 7 int main(void) { int lottonum[lotto_num]; int duplicate; srand(time(NULL)); printf("\n"); printf("Randomly choose %d numbers from 1 ~ %d\n", lotto_num, lotto_max); for (int i = 0; i < lotto_num; ++i) { int randomnum; do { randomnum = rand() % lotto_max + 1; duplicate = 0; for (int j = 0; j < i; ++j) { if (lottonum[j] ==..