#include <iostream>#include <iomanip>#include <cmath> int main(){ using namespace std; double start=-2, end=0, step=0.2; size_t n=size_t((end-start)/step)+1; cout << fixed << setprecision(3); for (size_t i=0; i != n; ++i) { double x = start+i*step; double y = atan(sqrt(x*x+1)); cout << "x = " << x << "\ty = " << y << endl; }}
Standard input is empty
x = -2.000 y = 1.150 x = -1.800 y = 1.119 x = -1.600 y = 1.083 x = -1.400 y = 1.044 x = -1.200 y = 1.001 x = -1.000 y = 0.955 x = -0.800 y = 0.908 x = -0.600 y = 0.862 x = -0.400 y = 0.822 x = -0.200 y = 0.795 x = 0.000 y = 0.785
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!