fork download
  1. ///Taller 2///
  2.  
  3. ///2) Un vector de 8 registros decimales (float) se llena con la fórmula x2 + y2. Encuentre los valores por debajo del promedio, y modifíquelos por la siguiente fórmula 2x2 + 3y. Teniendo en cuenta los x,y respectivos para cada posición del vector resultante. Posteriormente imprima una lista de los valores tanto de x,y como del vector resultado///
  4. #include<iostream>
  5. #include<math.h>
  6. using namespace std;
  7. int main()
  8. {
  9. int i;
  10. float Prom;
  11. float x[8], y[8], Registro[8];
  12. Prom=0;
  13. for(i=1 ; i<=8 ; i++)
  14. {
  15. cout<<"x = ";
  16. cin>>x[i];
  17. cout<<"y = ";
  18. cin>>y[i];
  19. Registro[i]=pow(x[i],2)+pow(y[i],2);
  20. Prom=Prom+Registro[i];
  21. }
  22. Prom=Prom/8;
  23. for(i=1; i<=8; i++)
  24. {
  25. if(Registro[i]<Prom)
  26. {
  27. Registro[i]=2*pow(x[i],2)+3*y[i];
  28. }
  29. }
  30. for(i=1; i<=8; i++)
  31. {
  32. cout<<" ( " <<x[i] <<" : " <<y[i];<<" ) " <<" = " <<Registro[i] <<endl;
  33. }
  34. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:32: error: expected primary-expression before ‘<<’ token
stdout
Standard output is empty