⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 list1808.cpp

📁 teach yourself C++ in 21 days 第五版
💻 CPP
字号:
#include <iostream>
// Using a Namespace
  
namespace Window
{
    const int MAX_X = 30 ;
    const int MAX_Y = 40 ;
    class Pane
    {
        public:
            Pane() ;
            ~Pane() ;
            void size( int x, int y ) ;
            void move( int x, int y ) ;
            void show( ) ;
        private:
            static int count ;
            int x ;
            int y ;
    };
} 
  
int Window::Pane::count = 0 ;
Window::Pane::Pane() : x(0), y(0) { }
Window::Pane::~Pane() { }
  
void Window::Pane::size( int x, int y )
{
    if( x < Window::MAX_X  &&  x > 0 )
        Pane::x = x ;
    if( y < Window::MAX_Y  &&  y > 0 )
        Pane::y = y ;
}
void Window::Pane::move( int x, int y )
{
    if( x < Window::MAX_X  &&  x > 0 )
        Pane::x = x ;
    if( y < Window::MAX_Y  &&  y > 0 )
        Pane::y = y ;
}
void Window::Pane::show( )
{
    std::cout << "x " << Pane::x ;
    std::cout << " y " << Pane::y << std::endl ;
}
  
int main( )
{
    Window::Pane pane ;
  
    pane.move( 20, 20 ) ;
    pane.show( ) ;
 
    return 0 ;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -