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 | float RekvP(float R1, float R2); | |
| 8 | - | int a[30][15]; |
| 8 | + | float RekvR(float R1, float R2); |
| 9 | - | int u,p,nedovoljni = 0; |
| 9 | + | |
| 10 | - | cout << "Program 4 | Veljko Kovacevic IV3" << endl; |
| 10 | + | cout << "Program 5 - Veljko Kovacevic IV3" << endl; |
| 11 | - | cout << "Broj ucenika: "; |
| 11 | + | float r1,r2,r3,r4; |
| 12 | - | cin >> u; |
| 12 | + | float r12, r123, Re; |
| 13 | - | cout << "Broj predmeta: "; |
| 13 | + | cout << "Unesi vrednosti otpornika" << endl; |
| 14 | - | cin >> p; |
| 14 | + | cout << "R1: "; |
| 15 | cin >> r1; | |
| 16 | cout << "R2: "; | |
| 17 | - | for (int i = 0; i < u; i++) |
| 17 | + | cin >> r2; |
| 18 | - | for (int j = 0; j < p; j++) {
|
| 18 | + | cout << "R3: "; |
| 19 | - | cout << "Ucenik " << i << " Predmet " << j << " : "; |
| 19 | + | cin >> r3; |
| 20 | - | cin >> a[i][j]; |
| 20 | + | cout << "R4: "; |
| 21 | - | if (a[i][j] == 1) nedovoljni++; |
| 21 | + | cin >> r4; |
| 22 | - | } |
| 22 | + | |
| 23 | r12 = RekvP(r1, r2); | |
| 24 | - | cout << endl; |
| 24 | + | r123 = RekvP(r12, r3); |
| 25 | Re = RekvR(r123, r4); | |
| 26 | - | for (int i = 0; i < u; i++) {
|
| 26 | + | |
| 27 | - | cout << "Ucenik " << i << " - "; |
| 27 | + | cout << "Ekvivalentna otpornost je " << Re; |
| 28 | - | for (int j = 0; j < p; j++) |
| 28 | + | } |
| 29 | - | cout << a[i][j] << " "; |
| 29 | + | |
| 30 | - | cout << endl; |
| 30 | + | float RekvP(float R1, float R2){
|
| 31 | - | } |
| 31 | + | return (R1*R2/(R1+R2)); |
| 32 | } | |
| 33 | - | cout << "Ima " << nedovoljni << " nedovoljnih."; |
| 33 | + | |
| 34 | - | } |
| 34 | + | float RekvR(float R1, float R2){
|
| 35 | return R1+R2; | |
| 36 | } | |
| 37 |