• Toshkent-2024 2-AMALIY MASH’GULOT 1-topshiriq Dastur sharti: Dastur kodi
  • Dastur natijasi: 2-topshiriq Dastur sharti: Dastur kodi
  • Dastur natijasi
  • Dasturlash fanidan bajargan ishi Amaliy topshiriq-2 Bajardi: Barchinoy Chiniqulova Guruh: 061-22 guruh




    Download 138,02 Kb.
    Sana23.05.2024
    Hajmi138,02 Kb.
    #250783
    Bog'liq
    Amaliy 2

    O‘ZBEKISTON RESPUBLIKASI AXBOROT TEXNOLOGIYALARI VA KOMMUNIKATSIYALARNI RIVOJLANTIRISH VAZIRLIGI MUHAMMAD Al- XORAZMIIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI



    Dasturlash fanidan bajargan ishi


    Amaliy topshiriq-2

    Bajardi: Barchinoy Chiniqulova
    Guruh: 061-22 guruh


    Toshkent-2024
    2-AMALIY MASH’GULOT


    1-topshiriq

    Dastur sharti:

    Dastur kodi:
    #include
    #include
    using namespace std;
    template
    void removeFirstElement(vector& vec) {
    if (!vec.empty()){
    vec.erase(vec.begin());
    }
    }
    int main(){
    vector intVector={1,2,3,4,5};
    cout<<"Asl int vektori: ";
    for(int elem:intVector){
    cout<}
    cout<removeFirstElement(intVector);
    cout<<"Birinchi element olib tashlanganidan keyin: ";
    for(int elem:intVector){
    cout<}
    cout<vector stringVector={"bir","ikki","uch","to'rt"};
    cout<<"Asl string vektori: ";
    for (const string& elem:stringVector){
    cout<}
    cout<removeFirstElement(stringVector);
    cout<<"Birinchi element olib tashlanganidan keyin: ";
    for (const string& elem:stringVector){
    cout<}
    cout<return 0;
    }
    Dastur natijasi:



    2-topshiriq
    Dastur sharti:

    Dastur kodi:
    #include
    #include
    #include
    using namespace std;
    void removeMaxElement(queue& q){
    if (q.empty()){
    return;
    }
    int maxElement=numeric_limits::min();
    queue tempQueue=q;
    while (!tempQueue.empty()){
    if (tempQueue.front()>maxElement){
    maxElement = tempQueue.front();
    }
    tempQueue.pop();
    }
    queue newQueue;
    while (!q.empty()) {
    if (q.front()!=maxElement){
    newQueue.push(q.front());
    }
    q.pop();
    }
    q=newQueue;
    }
    int main() {
    queue q;
    q.push(3);
    q.push(1);
    q.push(4);
    q.push(1);
    q.push(5);
    q.push(9);
    cout << "Asl navbat: ";
    queue tempQueue=q;
    while (!tempQueue.empty()) {
    cout<tempQueue.pop();
    }
    cout<removeMaxElement(q);
    while (!q.empty()) {
    cout<q.pop();
    }
    cout<return 0;
    }
    Dastur natijasi:

    Download 138,02 Kb.




    Download 138,02 Kb.

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Dasturlash fanidan bajargan ishi Amaliy topshiriq-2 Bajardi: Barchinoy Chiniqulova Guruh: 061-22 guruh

    Download 138,02 Kb.