calculation radius is 1 to the Ten the area of the circle, if the area is + to the - please output between
int Outputrotundityarea ( float* Presultarray , int &arraycount )
float* Presultarray : Type float array
Int Arraycount : Array Length
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