#include
#include
#include
using namespace std;
int main()
{
valarray v(10);
for(int i=0; i<10; i++)
v[i] = i;
cout << "Contenu initial de valarray: ";
for(i=0; i<10; i++)
cout << v[i] << " ";
cout << endl;
//Calculer la racine carrée de chaque élément
v = sqrt(v);
for(i=0; i<10; i++)
cout << v[i] << " ";
cout << endl;
return 0;
}
/*
Contenu initial de valarray: 0 1 2 3 4 5 6 7 8 9
0 1 1.41421 1.73205 2 2.23607 2.44949 2.64575 2.82843 3
*/