当前位置:网站首页>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
边栏推荐
- [Chongqing Guangdong education] higher mathematics I reference materials of Southwest Petroleum University
- What is the investment value of iFLYTEK, which does not make money?
- XSS challenges bypass the protection strategy for XSS injection
- Differences and usage scenarios between TCP and UDP
- Codeforces 5 questions par jour (1700 chacune) - jour 6
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 17
- Classic interview question [gem pirate]
- JS events (add, delete) and delegates
- Master data management theory and Practice
- C # create self host webservice
猜你喜欢
Apt installation ZABBIX
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 17
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 24
Introduction to robotframework (II) app startup of appui automation
[unity3d] GUI control
Introduction to robotframework (III) Baidu search of webui automation
[Digital IC manual tearing code] Verilog asynchronous reset synchronous release | topic | principle | design | simulation
Taobao focus map layout practice
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 10
4. File modification
随机推荐
How does yyds dry inventory deal with repeated messages in the consumption process?
Differences and usage scenarios between TCP and UDP
PMP practice once a day | don't get lost in the exam -7.5
有没有完全自主的国产化数据库技术
Introduction to robotframework (II) app startup of appui automation
Prototype design
Redis delete policy
Microservice registration and discovery
故障分析 | MySQL 耗尽主机内存一例分析
Spherical lens and cylindrical lens
【Kubernetes 系列】一文学会Kubernetes Service安全的暴露应用
Patch NTP server at the beginning of DDoS counterattack
07 singleton mode
[ruoyi] enable Mini navigation bar
【 kubernets series】 a Literature Study on the Safe exposure Applications of kubernets Service
MySQL winter vacation self-study 2022 11 (6)
【Unity3D】GUI控件
MySQL advanced notes
Follow the mouse's angle and keyboard events
Elimination games