3 amaliyot Vektorni eng katta va eng kichik elementlarini o’rni almashtirilsin. #include


Download 61.23 Kb.
Sana19.06.2023
Hajmi61.23 Kb.
#1623466
Bog'liq
3 amaliy ish


3 amaliyot
Vektorni eng katta va eng kichik elementlarini o’rni almashtirilsin.
#include
#include
using namespace std;
int main( ){
vector v;
cout<<"N=";
int a,n;
cin>>n;
for(int i=0;i
cout<
cin>>a;
v.push_back(a);
}
int max=v.at(0), min=v.at(0);
for(int i=0; i
if(max
max=v.at(i);
}
if(min>v.at(i)){
min=v.at(i);
}
}
cout<<"max="<
}


2 topshiriq.
Vektorning manfiy elementlari massivning eng kichik elementini kvadratiga almashtiring.
#include
#include
using namespace std;
int main( ){
vector v;
cout<<"N=";
int a,n;
cin>>n;
for(int i=0;i
cout<
cin>>a;
v.push_back(a);
}
int min=v.at(0);
for(int i=0;i
if(min>v.at(i)){
min=v.at(i);
}
}
int h=min*min;
for(int i=0;i
if(v.at(i)<0){
cout<
}
else {
cout<
}
}
}

Download 61.23 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling