• Aug 27, 2024 •vercetti322
0 likes • 5 views
#include <iostream> #include <vector> #include <algorithm> #include <cstdlib> #include <ctime> using namespace std; // Function to generate random numbers vector<int> generateRandomNumbers(int count, int minValue, int maxValue) { vector<int> numbers; for (int i = 0; i < count; ++i) { numbers.push_back(rand() % (maxValue - minValue + 1) + minValue); } return numbers; } // Function to print a vector of integers void printVector(const vector<int>& vec) { for (int num : vec) { cout << num << " "; } cout << endl; } // Function to sort and display numbers void sortAndDisplayNumbers(vector<int>& numbers) { sort(numbers.begin(), numbers.end()); cout << "Sorted numbers: "; printVector(numbers); } int main() { // Seed the random number generator srand(static_cast<unsigned int>(time(0))); int count, minValue, maxValue; cout << "Enter the number of random numbers to generate: "; cin >> count; cout << "Enter the minimum value: "; cin >> minValue; cout << "Enter the maximum value: "; cin >> maxValue; // Generate random numbers vector<int> numbers = generateRandomNumbers(count, minValue, maxValue); // Display unsorted numbers cout << "Unsorted numbers: "; printVector(numbers); // Sort and display sorted numbers sortAndDisplayNumbers(numbers); return 0; }
• Oct 8, 2025 •opovolotskyi-7e4a
var obj = { prop: 1, getProp: function(){ return function () { console.log(this.prop); } }, };
• Feb 21, 2025 •leafboo
0 likes • 1 view
console/log
• Jun 1, 2025 •abeRodrz99
0 likes • 3 views
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> </body> </html>
• Aug 17, 2025 •shekhar771
dzdzvcsd,v sd,.v, v,. ,.v , ,,vd,v dv
• May 13, 2025 •rejordon17-9956
fsdfsdfsdf