Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * 6] Ler 10 numeros e escrever o maior valor lido.
- */
- #include <iostream>
- // Dimensao do vetor
- #define DIM 10
- using std::cout;
- using std::cin;
- int main( void )
- {
- float numeros[DIM];
- float maior = 0;
- int i;
- // ========== Entrada de Dados ============
- for( i=0; i<DIM; i++ )
- {
- cout << "Elemento " << i+1 << ": ";
- cin >> numeros[i];
- // Verifica se o elemento digitado é maior que o suposto maior
- if( i == 0 )
- maior = numeros[i];
- else if( numeros[i] > maior )
- maior = numeros[i];
- }
- // ========== Saida de dados =============
- cout << "\nMaior elemento " << maior;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement