Advertisement
Guest User

Untitled

a guest
Apr 28th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <string>
  4. using namespace std;
  5.  
  6.  
  7. void nameSeparator(int separatorNumber)
  8. {
  9.  
  10. cout << endl << "----------End of Daily ";
  11. cout << separatorNumber << "----------" << endl << endl;
  12. }
  13. //daily one stuff
  14.  
  15. int sum, a, average, min, max;
  16. int numberArray[10] = { 100234,23,-5232,996,242,24,5239,-15,336,29 };
  17. //daily two stuff
  18.  
  19.  
  20. int steak;
  21. //daily 3 stuff
  22.  
  23.  
  24. int main()
  25. {
  26. cout << "Feels weird to have nothing here so, Hello World!" << endl << endl;
  27. nameSeparator(1); //end daily 1
  28.  
  29.  
  30.  
  31.  
  32.  
  33. for (a = 0; a<10; a++)
  34. {
  35. sum += numberArray[a];
  36. average = sum / 10;
  37. if (numberArray[a] < min)
  38. {
  39. min = numberArray[a];
  40. }
  41. if (numberArray[a] > max)
  42. {
  43. max = numberArray[a];
  44. }
  45.  
  46. }
  47. cout << "The sum of the values is: " << sum << endl;
  48. cout << "The average of the values is: " << average << endl;
  49. cout << "The minimum of the values is: " << min << endl;
  50. cout << "The maximum of the values is: " << max << endl;
  51. nameSeparator(2); //end of daily 2
  52.  
  53.  
  54.  
  55.  
  56.  
  57. cout << "Orignally entered array is: " << endl;
  58.  
  59. for (int a = 0; a<10; a++)
  60. {
  61. cout << numberArray[a];
  62. cout << ", ";
  63. }
  64. cout << endl << endl;
  65. for (int a = 0; a<9; a++)
  66. {
  67. for (int a = 0; a<9; a++)
  68. {
  69. if (numberArray[a]>numberArray[a + 1])
  70. {
  71. steak = numberArray[a];
  72. numberArray[a] = numberArray[a + 1];
  73. numberArray[a + 1] = steak;
  74. }
  75. }
  76. }
  77. cout << "Sorted Array is: " << endl;
  78. for (int a = 0; a<10; a++)
  79. {
  80. cout << numberArray[a];
  81. cout << ", ";
  82. }
  83. nameSeparator(3);
  84. //end of daily 3
  85.  
  86.  
  87.  
  88.  
  89.  
  90. system("pause");
  91. return 0;
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement