목록분류 전체보기 (351)
printf("ho_tari\n");
#include int main(void) { int nums1[] = {1, 2, 3, 4, 5}; int nums2[5]; //nums2 = nums1; //&nums2[0] = &nums1[0]; -- error for (int i = 0; i < 5; ++i) { nums2[i] = nums1[i]; } for (int i = 0; i < 5; ++i) { printf("%d ", nums2[i]); } printf("\n"); return 0; }
#include int main(void) { int a; int b; printf("input 2 nums : "); scanf("%d %d", &a, &b); printf("%d + %d = %d\n", a, b, a + b); printf("%d - %d = %d\n", a, b, a - b); printf("%d * %d = %d\n", a, b, a * b); printf("%d / %d = %d\n", a, b, a / b); printf("%d %% %d = %d\n", a, b, a % b); return 0; }
#include int main(void) { int num; scanf("%d", &num); int result; if (num >= 0) { result = num; } else { result = -num; } printf("absolute value : %d\n", result); return 0; } #include int main(void) { int num; scanf("%d", &num); //int result; //if (num >= 0) //{ //result = num; //} //else //{ //result = -num; //} //printf("absolute value : %d\n", result); printf("absolute value : %d\n", (num >= ..
#include int main(void) { //int code; //scanf("%d", &code); char c; scanf("%c", &c); int isBig = (c >= 65 && c = 'A' && code
//#include #include #include "queue.h" int main() { Queue q1(100), q2(10); //initQueue(&q1, 100); //initQueue(&q2, 10); q1.push(100); q1.push(200); q1.push(300); //printf("q1 1st pop() : %d\n", pop(&q1)); //printf("q1 2nd pop() : %d\n", pop(&q1)); //printf("q1 3rd pop() : %d\n", pop(&q1)); std::cout pArr[index]; }
//#include #include #include "stack.h" int main() { Stack s1(10), s2(100); //s1.initStack(10); //s2.initStack(100); s1.push(100); s1.push(200); s1.push(300); //s1.tos = 0; //printf("s1 1st pop() : %d\n", s1.pop()); std::cout tos]; }
#include #include "complex.h" int main() { Complex c1; // (0.0, 0.0i) //Complex c2(3.0); // (3.0, 0.0i) Complex c2 = 3.0; Complex c3(3.0, 4.0); // (3.0, 4.0i) Complex c4 = c3; // Complex c4(c3); //Complex c4; // default constructor //c4 = c3; // assignment. //c1.real(c3.real()); //c1.imag(c3.imag()); c1 = c3; // c1.operator = (c3) or operator = (c1, c3) // c1 = c2 = c3; // daisy-chain c1 += c2; ..