Français
Ouvrir dans Telegram

Fil de discussion Message n° 29809

16 messages · –
M
Fichier
-2147483648_-212719.jpg · 24 Ko · cliquez pour afficher
        1. M
          Harakat qb koʻrdm . Internettanam qarabam koʻrdm oʻxshamadi
        1. M
          Tasodifiy n sonli stekni to‘ldiring va shu stekdagi birinchi manfiy elementlarni toping.
          1. C
            #include <iostream> #include <stack> #include <time.h> #include <cctype> using namespace std; int main() { srand(time(0)); stack<int> s; int n; cout << "Enter the number of elements: "; cin >> n; // Stacking the elements for(int i=0; i<n; i++){ int element; cout << "Enter element " << i+1 << ": "; element=rand()%100; s.push(element); } // Finding the first negative element while(!s.empty()){ int element = s.top(); s.pop(); if(element < 0){ cout << "The first negative element is: " << element << endl; return 0; } } cout << "There is no negative element in the stack" << endl; return 0; }
            1. M
              Qaren bunisida tasodifiy sonla bilan dvottiku ushanga random qilib ishlanishi kerakmasmi.
        2. M
          Valarray sinfidan foydalanib, massivning barcha elementlari uchun dekrementini (prefiks (--i) va postfiks (i--) lar uchun) amalga oshiring
          1. C
            #include <iostream> #include <valarray> using namespace std; int main() { valarray<int> arr = {1, 2, 3, 4, 5}; // Dekrementation using prefix (--i) cout << "Prefix decrementation: "; for(int i=0; i<arr.size(); i++){ cout << --arr[i] << " "; } cout << endl; // Resetting array to original values arr = {1, 2, 3, 4, 5}; // Dekrementation using postfix (i--) cout << "Postfix decrementation: "; for(int i=0; i<arr.size(); i++){ cout << arr[i]-- << " "; } cout << endl; return 0; }
CC++ vs PythonC++ vs Python@cpp_vs_python · groupe · Technologie
114membres39 409messages dans l'index
Fil de la communauté Ouvrir dans Telegram

Un fil public ouvert issu de l'index de recherche ChatCrawler — « le Google du Telegram public » ; actualisé à mesure que la communauté est explorée. Les heures sont en UTC.

Contenu public uniquement, API officielle de Telegram. À propos · FAQ · Limites de l'index · Retirer une page · Catalogue · Recherche · Comment nous comptons