It then searches for the value of "pi" which has been defined as a macros. Then it takes in the input for the radius and goes to the calculation part. Then two 4(assuming 32/64-bit system) bits memory space are created for the two float variable. In the above program the compiler first compiling from the main function (here int main()). #define pi 3.14 //macros where the value of pi is definedĪreaOfCircle = pi * radius * radius //Calculating the area of the circleĬout<<"Area of the circle\n"<<areaOfCircle<<endl Ī macros is defined in the above program ( #define pi 3.14). Macros are defined so that the program run faster and is very efficient while doing competitive programming. Write a program to calculate area
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |