Advertisement
Guest User

Untitled

a guest
Jul 30th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. // monitos.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <vector>
  6. #include <string>
  7. #include <iostream>
  8.  
  9. using namespace std;
  10.  
  11. double nok = 2.422;
  12.  
  13. int antallPersoner;
  14. vector<int> tall;
  15. vector<string> folk;
  16. double sum = 0;
  17. double perPers;
  18.  
  19.  
  20. int main()
  21. {
  22. cin >> antallPersoner;
  23.  
  24. for(int j = 0; j < antallPersoner; j++)
  25. {
  26. int k;
  27. cin >> k;
  28. double y = k * 2.422;
  29. cout << y << endl;
  30. }
  31. for(int i = 0; i < antallPersoner; i++)
  32. {
  33. int curPris;
  34. string navn;
  35.  
  36. cin >> navn >> curPris;
  37.  
  38. tall.push_back(curPris);
  39. folk.push_back(navn);
  40.  
  41. sum += curPris;
  42. }
  43.  
  44. cout << "----------" << endl;
  45.  
  46. perPers = sum / antallPersoner;
  47.  
  48. cout << "Per person: " << perPers << endl << "----------" << endl;
  49.  
  50. for(int i = 0; i < antallPersoner; i++)
  51. {
  52. cout << folk[i] << " : " << (tall[i]-perPers) << endl;
  53. }
  54.  
  55. cin >> perPers;
  56. return 0;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement