View difference between Paste ID: jm8UtuMw and 3d632TFW
SHOW: | | - or go back to the newest paste.
1
#include <iostream>
2
#include <math.h>
3
#include <iomanip>
4
5
using namespace std;
6
int main(){
7-
	float x1,x2,y1,y2,d;
7+
    
8-
    cout << "Program 1 | Veljko Kovacevic IV3" << endl;
8+
    int n[20];
9-
    cout << "X1: ";
9+
    int nm;
10-
    cin >> x1;
10+
	cout << "Program 3 | Veljko Kovacevic IV3" << endl;
11-
    cout << "Y1: ";
11+
12-
    cin >> y1;
12+
    for(int i = 0; i < 20; i++) {
13-
    cout << "X2: ";
13+
        cout << "n[" << i << "] : ";
14-
    cin >> x2;
14+
        cin >> n[i];
15-
    cout << "Y2: ";
15+
    }
16-
    cin >> y2;
16+
17-
    d = ((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1));
17+
    nm = n[0];
18-
    d = sqrt(d);
18+
19-
    cout <<setw(7)<<setprecision(3)<< d;
19+
    for (int i = 0; i < 20; i++)
20-
    return 0;	
20+
        if(n[i] < nm) nm = n[i];
21
22
    cout << "Najmanji broj u nizu je " << nm << endl;
23
24
    cout << "Niz: " << endl;
25
    for (int i = 0; i < 20; i++)
26
        cout << n[i] << " ";
27
}