CaioCesar

Aula 3 - Trabalhando com vetores

Oct 5th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.13 KB | None | 0 0
  1. #include "iostream"
  2. #include "cstdlib"
  3. #include "conio.h"
  4. #include "string.h"
  5. #include "windows.h"
  6. #include "math.h"
  7. #define tam 3
  8. #define pi 3.14
  9. using namespace std;
  10. int main ()
  11. { setlocale(LC_ALL, "Portuguese");
  12. char tecla ;
  13. double co[tam], di[tam], ra[tam], ar[tam], x;
  14. int pos = -1;
  15. while (tecla != 27)
  16. { system("cls");
  17. cout << "\n***Menu de Controle ***\n \
  18. \n1 - Inserir Dados \
  19. \n2 - Efetuar Cálculos \
  20. \n3 - Exibir Listas \n \
  21. \nESC - Finalizar \
  22. \n\n\nITEM:";
  23. tecla = getch();
  24. if (tecla == '1')
  25. {
  26. system("cls");
  27. cout << "Digite o Comprimento:";
  28. pos ++; // pos = pos + 1
  29. cin >> co[pos];
  30. }
  31. else if (tecla == '2')
  32. {
  33. system("cls");
  34. cout << "aguarde processando lista ...";
  35. Sleep(3000);
  36. for (int i=0;i<=pos;i++)
  37. { di[i] = co[i] / pi;
  38. ra[i] = di[i] / 2;
  39. ar[i] = pow( ra[i] , 2 ) * pi;
  40. }
  41. }
  42. else if (tecla == '3')
  43. {
  44. system("cls");
  45. cout << "\n *** Gerando Relatório de Saída ***\n";
  46. Sleep(3000);
  47. for (int i=0;i<=pos;i++)
  48. { cout << "|" << co[i] << "|" << di[i] \
  49. << "|" << ra[i] << "|" << ar[i];
  50. }
  51. cout << "\n *** Fim do Relatório de Saída ***\n";
  52. system("pause");
  53. }
  54. } // fim do menu
  55. return 0;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment