In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to use the macro definition of c language to find the triangle area". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "how to use the c language macro definition to find the triangle area"!
Macro definition exercise to find the triangle area
1. Topic description
The area of the triangle = SQRT (S * (Smura) * (Smurb) * (SMEC)) where S = (a+b+c) / 2Magi a, b, c are the three sides of the triangle. Define two macros with parameters, one for area and the other for S. Write a program in which the macro name with arguments is used to calculate the area area.
two。 Format and sample
Input format
The three sides of an a b c triangle, which can be decimals.
Output format
Triangle area, keeping 3 decimal places.
Sample input
3 4 5
Sample output
6.000
3. Reference answer 1#include
2#include
3#define s (a _ r _ b _ m _ c) (a+b+c) / 2
4#define area (a _ r _ r _ b _ r _ r _ r s) sqrt (s * (m _ Meia) * (m _ Meib) * (m _ Mel c))
5int main ()
6 {
7float x,y,z
8scanf ("% f%f%f", & X.
9printf ("% .3f", area (x _ mae _ r _ r _ z _ r _ s (x _ menery _ z)
10return 0
11} at this point, I believe you have a deeper understanding of "how to use the c language macro definition to find the triangle area". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.