SHOW:
|
|
- or go back to the newest paste.
| 1 | #include <iostream> | |
| 2 | #include <math.h> | |
| 3 | #include <iomanip> | |
| 4 | ||
| 5 | using namespace std; | |
| 6 | ||
| 7 | - | int main() |
| 7 | + | int main(){
|
| 8 | - | {
|
| 8 | + | cout << "Program 2 | Veljko Kovacevic IV3" << endl; |
| 9 | - | float x,y,d; |
| 9 | + | int n, br = 0; |
| 10 | - | cout << "Nikola Krudulj IV3" << endl; |
| 10 | + | cin >> n; |
| 11 | - | cout << "X: "; |
| 11 | + | int starost[n]; |
| 12 | - | cin >> x; |
| 12 | + | for (int i = 0; i < n; i++){
|
| 13 | - | cout << "Y: "; |
| 13 | + | cout << "Ucenik " << i << " : "; |
| 14 | - | cin >> y; |
| 14 | + | cin >> starost[i]; |
| 15 | - | d = sqrt(pow(x, 2) + pow(y, 2)); |
| 15 | + | if(starost[i] >= 18) br++; |
| 16 | - | cout << setw(7) << setprecision(3) << d; |
| 16 | + | } |
| 17 | - | return 0; |
| 17 | + | cout << "Ima " << br << " punoletnih"; |
| 18 | - | } |
| 18 | + | } |