목록C++ (45)
printf("ho_tari\n");
#include #include "rational.h" int main() { Rational r1; // 0/1 Rational r2 = 1; // 1/1 //Rational r2(1); Rational r3(3, 4); // 3/4 Rational r4 = r3; //r1.setNum(r3.getNum()); //r1.setNum(r3.getNum()); r1 = r3; if (r1 == r3) { std::cout
#include #include "string.h" int main() { String s1; String s2 = "hello, world"; // String s2("hello"); String s3 = s2; // String s3(s2); String s4 = "aaa"; String s5 = "bbb"; s1 = s2; if (s1 == s2) { std::cout
//#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; ..