Search
 
SCRIPT & CODE EXAMPLE
 

CPP

min element c++

#include <algorithm>
#include <iostream>
#include <vector>
 
int main()
{
    std::vector<int> v{3, 1, 4, 1, 5, 9};
 
    std::vector<int>::iterator result = std::min_element(v.begin(), v.end());
    std::cout << "min element at: " << std::distance(v.begin(), result);
}
Comment

find min element in c++

#include <iostream>
using namespace std;

int main() {
	int n;
	cout <<"How many element yo will enter?"<<endl;
	cin >> n;
	int arr[n];
	for(int i=0;i<n;i++){
		cout << "Your "<< i+1 <<" number : ";
		cin >> arr[i];
	}
	for(int i=0;i<n;i++){
		if(arr[0]>arr[i]){
			arr[0]>arr[i];
		}
	}
	cout << "The min element is :"<<arr[0];
	return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ check if string is empty 
Cpp :: delete file cpp 
Cpp :: taking a vector in c++ containing element 
Cpp :: c++ array loop 
Cpp :: opencv rgb to gray c++ 
Cpp :: remove last character from string c++ 
Cpp :: qt disable resizing window 
Cpp :: unordered_map header file c++ 
Cpp :: how to string to integer in c++ 
Cpp :: c++ program to find prime number using function 
Cpp :: c++ for in 
Cpp :: Frequency of a substring in a string C++ 
Cpp :: string to int in c++ 
Cpp :: copy a part of a vector in another in c++ 
Cpp :: singleton c++ 
Cpp :: c++ int main() 
Cpp :: c++ function 
Cpp :: c++ init multidimensional vector 
Cpp :: max_element c++ 
Cpp :: c++ get char of string 
Cpp :: convert string to lpwstr 
Cpp :: C++ program that prints the prime numbers from 1 to 1000. 
Cpp :: how to use char in c++ 
Cpp :: vector length c++ 
Cpp :: function c++ 
Cpp :: char size length c++ 
Cpp :: sorting using comparator in c++ 
Cpp :: how to print a text in c++ 
Cpp :: char to integer c++ 
Cpp :: C++ fill string with random uppercase letters 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =