Created
June 17, 2015 23:38
-
-
Save sandes/1ed4be521060b9d14471 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int *miny(int *v,int n){ | |
int x=v[0],jmin=0; | |
for (int i=0; i<n; i++){ | |
if(v[i]<x){ | |
jmin=i; | |
x=v[jmin]; | |
} | |
} | |
return &v[jmin]; | |
} | |
void print(int *v,int n){ | |
cout << "V: ("; | |
for (int j=0; j<n; j++) cout << v[j] << " "; | |
cout << "), valor minimo: " << *miny(v,n) << endl; | |
} | |
int main(int argc, char *argv[]) { | |
int v[]={3,2,9,5,6}; | |
int n = 5; | |
/* | |
multiplica por 2 el valor minimo | |
y el VM mostrado es el proximo minimo | |
*/ | |
*miny(v,n)=2*(*miny(v,n)); | |
print (v,n); | |
/**/ | |
return 0; | |
} | |