fork download
  1. #include <iostream>
  2. #include <cmath>
  3. #include <iomanip>
  4.  
  5. int main() {
  6. std::cout << std::fixed << std::setprecision(2);
  7.  
  8. for (double x = -2; x <= 2; x += 0.5) {
  9. for (double y = -1; y <= 1; y += 0.1) {
  10. double u = std::sin(x) + std::cos(y);
  11. std::cout << "x: " << x << ", y: " << y << ", u: " << u << std::endl;
  12. }
  13. }
  14.  
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
x: -2.00, y: -1.00, u: -0.37
x: -2.00, y: -0.90, u: -0.29
x: -2.00, y: -0.80, u: -0.21
x: -2.00, y: -0.70, u: -0.14
x: -2.00, y: -0.60, u: -0.08
x: -2.00, y: -0.50, u: -0.03
x: -2.00, y: -0.40, u: 0.01
x: -2.00, y: -0.30, u: 0.05
x: -2.00, y: -0.20, u: 0.07
x: -2.00, y: -0.10, u: 0.09
x: -2.00, y: -0.00, u: 0.09
x: -2.00, y: 0.10, u: 0.09
x: -2.00, y: 0.20, u: 0.07
x: -2.00, y: 0.30, u: 0.05
x: -2.00, y: 0.40, u: 0.01
x: -2.00, y: 0.50, u: -0.03
x: -2.00, y: 0.60, u: -0.08
x: -2.00, y: 0.70, u: -0.14
x: -2.00, y: 0.80, u: -0.21
x: -2.00, y: 0.90, u: -0.29
x: -2.00, y: 1.00, u: -0.37
x: -1.50, y: -1.00, u: -0.46
x: -1.50, y: -0.90, u: -0.38
x: -1.50, y: -0.80, u: -0.30
x: -1.50, y: -0.70, u: -0.23
x: -1.50, y: -0.60, u: -0.17
x: -1.50, y: -0.50, u: -0.12
x: -1.50, y: -0.40, u: -0.08
x: -1.50, y: -0.30, u: -0.04
x: -1.50, y: -0.20, u: -0.02
x: -1.50, y: -0.10, u: -0.00
x: -1.50, y: -0.00, u: 0.00
x: -1.50, y: 0.10, u: -0.00
x: -1.50, y: 0.20, u: -0.02
x: -1.50, y: 0.30, u: -0.04
x: -1.50, y: 0.40, u: -0.08
x: -1.50, y: 0.50, u: -0.12
x: -1.50, y: 0.60, u: -0.17
x: -1.50, y: 0.70, u: -0.23
x: -1.50, y: 0.80, u: -0.30
x: -1.50, y: 0.90, u: -0.38
x: -1.50, y: 1.00, u: -0.46
x: -1.00, y: -1.00, u: -0.30
x: -1.00, y: -0.90, u: -0.22
x: -1.00, y: -0.80, u: -0.14
x: -1.00, y: -0.70, u: -0.08
x: -1.00, y: -0.60, u: -0.02
x: -1.00, y: -0.50, u: 0.04
x: -1.00, y: -0.40, u: 0.08
x: -1.00, y: -0.30, u: 0.11
x: -1.00, y: -0.20, u: 0.14
x: -1.00, y: -0.10, u: 0.15
x: -1.00, y: -0.00, u: 0.16
x: -1.00, y: 0.10, u: 0.15
x: -1.00, y: 0.20, u: 0.14
x: -1.00, y: 0.30, u: 0.11
x: -1.00, y: 0.40, u: 0.08
x: -1.00, y: 0.50, u: 0.04
x: -1.00, y: 0.60, u: -0.02
x: -1.00, y: 0.70, u: -0.08
x: -1.00, y: 0.80, u: -0.14
x: -1.00, y: 0.90, u: -0.22
x: -1.00, y: 1.00, u: -0.30
x: -0.50, y: -1.00, u: 0.06
x: -0.50, y: -0.90, u: 0.14
x: -0.50, y: -0.80, u: 0.22
x: -0.50, y: -0.70, u: 0.29
x: -0.50, y: -0.60, u: 0.35
x: -0.50, y: -0.50, u: 0.40
x: -0.50, y: -0.40, u: 0.44
x: -0.50, y: -0.30, u: 0.48
x: -0.50, y: -0.20, u: 0.50
x: -0.50, y: -0.10, u: 0.52
x: -0.50, y: -0.00, u: 0.52
x: -0.50, y: 0.10, u: 0.52
x: -0.50, y: 0.20, u: 0.50
x: -0.50, y: 0.30, u: 0.48
x: -0.50, y: 0.40, u: 0.44
x: -0.50, y: 0.50, u: 0.40
x: -0.50, y: 0.60, u: 0.35
x: -0.50, y: 0.70, u: 0.29
x: -0.50, y: 0.80, u: 0.22
x: -0.50, y: 0.90, u: 0.14
x: -0.50, y: 1.00, u: 0.06
x: 0.00, y: -1.00, u: 0.54
x: 0.00, y: -0.90, u: 0.62
x: 0.00, y: -0.80, u: 0.70
x: 0.00, y: -0.70, u: 0.76
x: 0.00, y: -0.60, u: 0.83
x: 0.00, y: -0.50, u: 0.88
x: 0.00, y: -0.40, u: 0.92
x: 0.00, y: -0.30, u: 0.96
x: 0.00, y: -0.20, u: 0.98
x: 0.00, y: -0.10, u: 1.00
x: 0.00, y: -0.00, u: 1.00
x: 0.00, y: 0.10, u: 1.00
x: 0.00, y: 0.20, u: 0.98
x: 0.00, y: 0.30, u: 0.96
x: 0.00, y: 0.40, u: 0.92
x: 0.00, y: 0.50, u: 0.88
x: 0.00, y: 0.60, u: 0.83
x: 0.00, y: 0.70, u: 0.76
x: 0.00, y: 0.80, u: 0.70
x: 0.00, y: 0.90, u: 0.62
x: 0.00, y: 1.00, u: 0.54
x: 0.50, y: -1.00, u: 1.02
x: 0.50, y: -0.90, u: 1.10
x: 0.50, y: -0.80, u: 1.18
x: 0.50, y: -0.70, u: 1.24
x: 0.50, y: -0.60, u: 1.30
x: 0.50, y: -0.50, u: 1.36
x: 0.50, y: -0.40, u: 1.40
x: 0.50, y: -0.30, u: 1.43
x: 0.50, y: -0.20, u: 1.46
x: 0.50, y: -0.10, u: 1.47
x: 0.50, y: -0.00, u: 1.48
x: 0.50, y: 0.10, u: 1.47
x: 0.50, y: 0.20, u: 1.46
x: 0.50, y: 0.30, u: 1.43
x: 0.50, y: 0.40, u: 1.40
x: 0.50, y: 0.50, u: 1.36
x: 0.50, y: 0.60, u: 1.30
x: 0.50, y: 0.70, u: 1.24
x: 0.50, y: 0.80, u: 1.18
x: 0.50, y: 0.90, u: 1.10
x: 0.50, y: 1.00, u: 1.02
x: 1.00, y: -1.00, u: 1.38
x: 1.00, y: -0.90, u: 1.46
x: 1.00, y: -0.80, u: 1.54
x: 1.00, y: -0.70, u: 1.61
x: 1.00, y: -0.60, u: 1.67
x: 1.00, y: -0.50, u: 1.72
x: 1.00, y: -0.40, u: 1.76
x: 1.00, y: -0.30, u: 1.80
x: 1.00, y: -0.20, u: 1.82
x: 1.00, y: -0.10, u: 1.84
x: 1.00, y: -0.00, u: 1.84
x: 1.00, y: 0.10, u: 1.84
x: 1.00, y: 0.20, u: 1.82
x: 1.00, y: 0.30, u: 1.80
x: 1.00, y: 0.40, u: 1.76
x: 1.00, y: 0.50, u: 1.72
x: 1.00, y: 0.60, u: 1.67
x: 1.00, y: 0.70, u: 1.61
x: 1.00, y: 0.80, u: 1.54
x: 1.00, y: 0.90, u: 1.46
x: 1.00, y: 1.00, u: 1.38
x: 1.50, y: -1.00, u: 1.54
x: 1.50, y: -0.90, u: 1.62
x: 1.50, y: -0.80, u: 1.69
x: 1.50, y: -0.70, u: 1.76
x: 1.50, y: -0.60, u: 1.82
x: 1.50, y: -0.50, u: 1.88
x: 1.50, y: -0.40, u: 1.92
x: 1.50, y: -0.30, u: 1.95
x: 1.50, y: -0.20, u: 1.98
x: 1.50, y: -0.10, u: 1.99
x: 1.50, y: -0.00, u: 2.00
x: 1.50, y: 0.10, u: 1.99
x: 1.50, y: 0.20, u: 1.98
x: 1.50, y: 0.30, u: 1.95
x: 1.50, y: 0.40, u: 1.92
x: 1.50, y: 0.50, u: 1.88
x: 1.50, y: 0.60, u: 1.82
x: 1.50, y: 0.70, u: 1.76
x: 1.50, y: 0.80, u: 1.69
x: 1.50, y: 0.90, u: 1.62
x: 1.50, y: 1.00, u: 1.54
x: 2.00, y: -1.00, u: 1.45
x: 2.00, y: -0.90, u: 1.53
x: 2.00, y: -0.80, u: 1.61
x: 2.00, y: -0.70, u: 1.67
x: 2.00, y: -0.60, u: 1.73
x: 2.00, y: -0.50, u: 1.79
x: 2.00, y: -0.40, u: 1.83
x: 2.00, y: -0.30, u: 1.86
x: 2.00, y: -0.20, u: 1.89
x: 2.00, y: -0.10, u: 1.90
x: 2.00, y: -0.00, u: 1.91
x: 2.00, y: 0.10, u: 1.90
x: 2.00, y: 0.20, u: 1.89
x: 2.00, y: 0.30, u: 1.86
x: 2.00, y: 0.40, u: 1.83
x: 2.00, y: 0.50, u: 1.79
x: 2.00, y: 0.60, u: 1.73
x: 2.00, y: 0.70, u: 1.67
x: 2.00, y: 0.80, u: 1.61
x: 2.00, y: 0.90, u: 1.53
x: 2.00, y: 1.00, u: 1.45