Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Zimplementuj program ktory w wektorze o max. 50 elementach znajdzie element max i okresli jego polozenie
- #include <iostream>
- using std::cout;
- using std::cin;
- using std::endl;
- int main()
- {
- int max, t[50], polozenie=1, n;
- cout << "Program znajedzie max i okresli jego polozenie" << endl
- << "Podaj ile elementow chcesz wprowadzic : ";
- cin >> n;
- for(int x=0; x<n; x++)
- {
- cout << "Podaj " << x+1 << " liczbe : ";
- cin >> t[x];
- if(x==0)
- max=t[x];
- else if(t[x]>max)
- {
- max=t[x];
- polozenie=x+1;
- }
- }
- cout << "MAKSYMALNA = " << max << endl;
- cout << "POLOZENIE = " << polozenie << endl;
- cin.get();
- cin.get();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement