2006-12-05から1日間の記事一覧
#include <iostream> class Point2{ public: Point2(int ax = 0, int ay = 0); Point2 operator+(Point2 &a); int x, y; }; Point2::Point2(int ax, int ay) { x = ax; y = ay; } Point2 Point2::operator+(Point2 &a) { return Point2(x + a.x, y + a.y); } std::ostr</iostream>…
#include <iostream> class IncChar { public: IncChar(char ac = 'a'); IncChar &operator++(); char c; }; IncChar::IncChar(char ac) { c = ac; } IncChar &IncChar::operator++() { c++; if(c > 'z') c = 'a'; return *this; } int main() { IncChar incchar('t');</iostream>…
#include <iostream> int c = 0; void inc(int &x) { x++; } int &ref_c() { return c; } int main() { int a = 3; int &ra = a; std::cout << "a = " << a << "\n"; ra = 15; std::cout << "a = " << a << "\n"; int b = 4; std::cout << "b = " << b << "\n"; inc(b)</iostream>…
#include <iostream> #include "point.cpp" #include "canvas.cpp" #include "shape.cpp" #include "rect.cpp" #include "triangle.cpp" #include "square.cpp" int main() { Canvas c; Shape *shape[3]; Rect r(5, 5, 20, 10); shape[0] = &r; Triangle t(1, 18, 16, </iostream>…
#include <iostream> class Base{ public: void showName(); }; void Base::showName() { std::cout << "I am Base.\n"; } class Derived : public Base{ public: void showName(); }; void Derived::showName() { std::cout << "I am Derived.\n"; } int main() { Bas</iostream>…
D:\cp>tracert yahoo.co.jp Tracing route to yahoo.co.jp [203.216.235.201] over a maximum of 30 hops: 1 3 ms 3 ms 3 ms 192.168.0.1 2 58 ms 29 ms 29 ms 10.249.8.1 3 52 ms 29 ms 29 ms 10.249.255.2 4 30 ms 29 ms 29 ms 211.132.120.1 5 57 ms 29 m…
#include <iostream> class Base{ public: void showName(); }; void Base::showName() { std::cout << "I am Base.\n"; } class Derived : public Base{ public: void showName(); }; void Derived::showName() { std::cout << "I am Derived.\n"; } int main() { Der</iostream>…