当前位置:网站首页>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
边栏推荐
- Deeply analyze the chain 2+1 mode, and subvert the traditional thinking of selling goods?
- 纯Qt版中国象棋:实现双人对战、人机对战及网络对战
- 主数据管理(MDM)的成熟度
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 21
- 07 单件(Singleton)模式
- PMP practice once a day | don't get lost in the exam -7.5
- Codeforces 5 questions par jour (1700 chacune) - jour 6
- js 正则过滤和增加富文本中图片前缀
- Spherical lens and cylindrical lens
- Modeling specifications: naming conventions
猜你喜欢
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 6
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 20
微服务注册与发现
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 22
Communication between microservices
不赚钱的科大讯飞,投资价值该怎么看?
C language - Blue Bridge Cup - promised score
XSS challenges绕过防护策略进行 XSS 注入
Blue Bridge Cup group B provincial preliminaries first question 2013 (Gauss Diary)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 8
随机推荐
【若依(ruoyi)】启用迷你导航栏
XSS challenges绕过防护策略进行 XSS 注入
Communication between microservices
Huawei, H3C, Cisco command comparison, mind map form from the basic, switching, routing three directions [transferred from wechat official account network technology alliance station]
Yyds dry inventory comparison of several database storage engines
Apt installation ZABBIX
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 18
Which ecology is better, such as Mi family, graffiti, hilink, zhiting, etc? Analysis of five mainstream smart brands
C language - Blue Bridge Cup - promised score
原型图设计
主数据管理理论与实践
How to read excel, PDF and JSON files in R language?
Network Security Learning - Web vulnerabilities (Part 1)
[Digital IC manual tearing code] Verilog asynchronous reset synchronous release | topic | principle | design | simulation
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 22
What is the investment value of iFLYTEK, which does not make money?
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 6
不赚钱的科大讯飞,投资价值该怎么看?
Solution: attributeerror: 'STR' object has no attribute 'decode‘
Installation and use tutorial of cobaltstrike-4.4-k8 modified version