Horje
transform c++ Code Example
transform c++
// A C++ program uses transform() in STL to add 
// 1 to all elements of arr[]
#include <bits/stdc++.h>
using namespace std;
   
int increment(int x) {  return (x+1); }
   
int main()
{
    int arr[] = {1, 2, 3, 4, 5};
    int n = sizeof(arr)/sizeof(arr[0]);
   
    // Apply increment to all elements of
    // arr[] and store the modified elements
    // back in arr[]
    transform(arr, arr+n, arr, increment);
   
    for (int i=0; i<n; i++)
        cout << arr[i] <<" ";
   
    return 0;
}




Cpp

Related
climits in cpp Code Example climits in cpp Code Example
vector with initial size Code Example vector with initial size Code Example
check if a variable is tring c++ Code Example check if a variable is tring c++ Code Example
break input stream into words Code Example break input stream into words Code Example
oop in c++ have 5 Code Example oop in c++ have 5 Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8