Buscar

Questionários The Huxley - "Pesquisa"

Esta é uma pré-visualização de arquivo. Entre para ver o arquivo original

#include <iostream>
#include <iomanip>
using namespace std;
float vantagem (){
 int n;
 cin >> n;
 float candidato[n], concorrente[n];
 float MaiorVantagem = 0;
 for (int a=0; a < n; a++){
 cin >> candidato[a];
 }
 for (int b=0; b < n; b++){
 cin >> concorrente[b];
 }
 for ( int c=0; c < n; c++){
 if (candidato[c] > concorrente[c] && (candidato[c]-concorrente[c]) > MaiorVantagem){
 MaiorVantagem = candidato[c] - concorrente[c];
 }
 }
 cout << fixed << setprecision(2) << MaiorVantagem << endl;
 return MaiorVantagem;
}
int main (void) {
 vantagem ();
 return 0;
}

Teste o Premium para desbloquear

Aproveite todos os benefícios por 3 dias sem pagar! 😉
Já tem cadastro?

Outros materiais