当前位置:网站首页>Daily question brushing plan-2-13 fingertip life
Daily question brushing plan-2-13 fingertip life
2022-07-06 02:54:00 【Konjak_ Konnyaku】
「 This is my participation 2022 For the first time, the third challenge is 25 God , Check out the activity details : 2022 For the first time, it's a challenge
BC140 KiKi Design class inheritance
describe
KiKi Understand that inheritance can make code reuse , He now defines a base class shape, Private data is coordinate point x,y, Derived from it Rectangle Classes and Circle class , They all have member functions GetArea() Find the area . Derived class Rectangle Class has data : The length and width of the rectangle ; Derived class Circle Class has data : The radius of the circle .Rectangle Class derives square Square class , Define and test . Enter three sets of data , They are the length and width of the rectangle 、 The radius of the circle 、 The side length of a square , Output three groups of data , They are rectangles 、 round 、 The square area . PI by 3.14 Calculation .
Input description :
Enter three lines ,
The first line is the length and width of the rectangle ,
The second line is the radius of the circle ,
The third line is the side length of the square .
Output description :
Three elements , They are rectangles 、 round 、 The square area .
Example 1
Input :
Copy
Output :
Copy
Function knowledge
1. Functions cannot be nested , But you can nest calls
2.printf() : Returns the number of characters printed on the screen , If an error occurs , Return negative
3.scanf() : Returns the number of valid characters successfully read
4. Functions can be accessed in a chain
5. You can use global variables to pass parameters
6. Functions can have no return value
7. The definition of a function can be placed anywhere , The declaration of a function must be placed before the use of the function
- The declaration of a function simply tells the compiler the type of the return value of the function 、 Function name and parameters required by the function , The function definition is to explain how the function is implemented
- Formal parameters are instantiated only when the function is called , To open up memory space
- When passing parameters, whether by value or pointer , All the formal parameters get is a copy of the argument
- Formal parameters are instantiated only when the function is called , To open up memory space
- main The position of the function can be anywhere , Top note, but if you call those functions before the main function , Must be in main The header file that contains the life of the called function or the called function before the function .
- Variables defined in compound statements within a function can only be used in compound statements , Not valid within the scope of this function
- The formal parameters of a function are generally passed by pressing the stack of parameters , The formal parameters in the function are saved in the stack
- Different functions belong to different scopes , Therefore, variables with the same name defined in different functions will not conflict
- Variables defined in functions , It's called a local variable , Local variables can only be used in the functions they define , Variables defined within a function are valid only within the scope of this function
边栏推荐
- Microsoft speech synthesis assistant v1.3 text to speech tool, real speech AI generator
- 如何精准识别主数据?
- [Yu Yue education] basic reference materials of digital electronic technology of Xi'an University of Technology
- 【Kubernetes 系列】一文学会Kubernetes Service安全的暴露应用
- PMP practice once a day | don't get lost in the exam -7.5
- 华为、H3C、思科命令对比,思维导图形式从基础、交换、路由三大方向介绍【转自微信公众号网络技术联盟站】
- My C language learning record (blue bridge) -- under the pointer
- JS events (add, delete) and delegates
- Communication between microservices
- 07 单件(Singleton)模式
猜你喜欢
【Kubernetes 系列】一文学会Kubernetes Service安全的暴露应用
RobotFramework入门(一)简要介绍及使用
Master data management theory and Practice
PMP practice once a day | don't get lost in the exam -7.5
1. Dynamic parameters of function: *args, **kwargs
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 15
Referenceerror: primordials is not defined error resolution
MySQL advanced notes
Installation and use tutorial of cobaltstrike-4.4-k8 modified version
Reverse repackaging of wechat applet
随机推荐
Deeply analyze the chain 2+1 mode, and subvert the traditional thinking of selling goods?
My C language learning records (blue bridge) -- files and file input and output
Self made CA certificate and SSL certificate using OpenSSL
Misc (eternal night), the preliminary competition of the innovation practice competition of the National College Students' information security competition
"Hands on learning in depth" Chapter 2 - preparatory knowledge_ 2.5 automatic differentiation_ Learning thinking and exercise answers
Referenceerror: primordials is not defined error resolution
C # create self host webservice
Summary of Bible story reading
MySQL winter vacation self-study 2022 11 (6)
Solve 9 with C language × 9 Sudoku (personal test available) (thinking analysis)
会员积分营销系统操作的时候怎样提升消费者的积极性?
Patch NTP server at the beginning of DDoS counterattack
【指针训练——八道题】
RobotFramework入门(二)appUI自动化之app启动
Classic interview question [gem pirate]
MySQL learning notes-10-tablespace recycling
微服务间通信
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 7
一个复制也能玩出花来
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 11