Guruh talabasi Omonbayev Jaloliddin
Download 26.83 Kb.
|
7. Chiziqsiz MT
911-21 guruh talabasi Omonbayev Jaloliddin Mavzu : Chiziqsiz MT. Navbat eng katta elementi topilsin va undan keyin 0 joylashtirilsin. #include #include using namespace std; int main(){ int n,max1 = INT_MIN; cin>>n; queue int maxi; for (int i=1; i<=n; i++){ int k; cin>>k; a.push(k); max1 = max(max1,k); if (max1 == k) maxi = i; } int d=1; while (!a.empty()){ if (d==maxi){ cout< } else { cout< a.pop(); d++; } } 2. Navbat birinchi elementiga teng elementlari o’chirilsin. #include using namespace std; int main() { queue queue int n,k; cout <<"n= ";cin>>n; for(int i=0;i cin>>k; q.push(k); } int a=q.front(); while(!q.empty()) { int b=q.front(); if(b!=a) { q2.push(b); } q.pop(); } while(!q2.empty()) { cout< Download 26.83 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling