To find the area of a circle

Source: Internet
Author: User

    • Topic background

calculation radius is 1 to the Ten the area of the circle, if the area is + to the - please output between

    • Interface

int Outputrotundityarea ( float* Presultarray , int &arraycount )

float* Presultarray : Type float array

Int Arraycount : Array Length

    • Specifications

Requires a time complexity of O (n)

π= 3.14

This problem is actually very simple, but the title and the download of the project file in the function parameters, the downloaded function prototype is:

#include <stdlib.h> #include <string.h> #include "oj.h"/* Function:    input:     output: Arrvalue: Stores the circle area within the returned range, Memory has been applied outside the function Nvalue: Returns the number of rows returned by the array     :      */void outputrotundityarea (float *arrvalue,int &nvalue) {}

The purpose of the topic is to calculate the area of a radius of 1-10, and then store the results of the matching criteria in an array, where it is easy to confuse the difference between the number of floating-point numbers and the size.

Full code:

#include <stdlib.h> #include <string.h> #include "oj.h"/* Function:    input:     output: Arrvalue: Stores the circle area within the returned range, Memory has been applied outside the function Nvalue: Returns the number of rows returned by the array     :      */void outputrotundityarea (float *arrvalue,int &nvalue) {  nvalue=0;  float area;  for (int i=1;i<=10;i++)  {     area=3.14*i*i; if (area>=40&&area<=90) Arrvalue[nvalue++]=area;}  }


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

To find the area of a circle

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.