Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Codigo do exercicio 2 da pagina 161 (livro Luis Damas)
- #include <stdio.h>
- #include <stdlib.h>
- #define N 10
- int retorno (float[], int);
- int main (void){
- int analise (int);
- float vetor[N];
- int numLim;
- printf("Digite 10 valores:\n");
- for(int i=0;i<N;i++){
- scanf("%f", &vetor[i]);
- }
- printf("\nLimitacao de verificao(1~10):");
- scanf("%d", &numLim);
- analise(retorno(vetor, numLim)); //<---- 'analise' recebe outra função que recebe dois argumentos
- return 0;
- }
- int analise (int lim){
- /*
- **o problema é que possivelmente essa função tambem lê o valor do array e imprime o argumento de 'else'
- */
- if ((lim>=1) && (lim<=10)){
- system ("clear");
- }
- else
- printf("Limitacao excedida!\n");
- }
- int retorno (float v[N], int n){
- float max;
- max = v[0];
- for(int i=0;i<n;i++){
- if(v[i] > max)
- max = v[i];
- }
- printf("Maior Valor dos numeros digitados:[%.1f]\nLimitacao usada:[%d]", max, n);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement