ABOUTYOU
随便写的,没测试,每个都包含了下面的include#inlcude <iostream>using namespace std;1.int main(int argc, char *argv[]){for (char i = 32; i <= 127; i++){cout << i << " ";}cout << endl;return 0;}2.int main(int argc, char *argv[]){char choice;do{cout << "现在正在下雨吗?(Y/N)" << endl;cin >> ch;if ('Y' == ch) { cout << "现在正在下雨。" << endl; break; }else if ('N' == ch) { cout << "现在没有下雨。" << endl; break; }} while(true);return 0;}3.typedef struct _point{int x;int y;}point;class Rectangle{public:Rectangle() {}Rectangle(const point &topleft, const point &bottomright) : m_topleft(topleft), m_bottomright(bottomright) {}int size(){int ret = (topleft.x - bottomright.x) * (topleft.y - bottomright.y);return ret > 0 ? ret : -ret;}private:point m_topleft;point m_bottomright;};int main(int argc, char *argv[]){point topleft = {10,10}, bottomright = {100,100};Rectangle rect(topleft, bottomright);cout << "size: " << rect.size() << endl;return 0;return 0;}4.class Circle{public:Circle() : m_radius(0.0) {}Circle(const double &radius) : m_radius(radius) {}double size(){return 3.14159265 * m_radius * m_radius;}private:double m_radius;};int main(int argc, char *argv[]){double radius = 10.0;Circle c(radius);cout << "size: " << c.size() << endl;return 0;}