Phoenix_x

Untitled

Dec 13th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <string>
  4. #include <fstream>
  5.  
  6.  
  7. struct Team {
  8. string ime;
  9. int vkaraniGolove;
  10. int dopusnatiGolove;
  11. int tochki;
  12. };
  13.  
  14. void writeIntoArrayAndFile(Team otbori[50], int &size);
  15.  
  16. using namespace std;
  17.  
  18. void main()
  19. {
  20. Team otbori[50];
  21. int izbor;
  22.  
  23. while (true)
  24. {
  25. cout << "Izberi 1 za vavezdane vav fajl i masiv" << endl;
  26. cout << "Izberi 2 za izvezdane na otbori s vkarani glove poveche ot 10 i dopusnati po - malko ot 5" << endl;
  27. cout << "Izberi 3 za izvezdane na vsichki otbori po azbuchen red na imenata" << endl;
  28.  
  29. cout << "Izbor: ";
  30. cin >> izbor;
  31.  
  32. switch (izbor)
  33. {
  34. case 1:
  35. break;
  36. case 2:
  37. break;
  38. case 3
  39. :break;
  40. default:
  41. break;
  42. }
  43. }
  44. }
  45.  
  46. void writeIntoArrayAndFile(Team otbori[50], int &size)
  47. {
  48. ofstream writeOnFile; //променлива, с която ще се пише по файла
  49.  
  50. cout << "Broj otbori: ";
  51. cin >> size;
  52.  
  53. writeOnFile.open("otbori.txt");
  54.  
  55.  
  56. for (int i = 0; i < size; i++)
  57. {
  58. cout << "Vavedi informaciq za otbor 1 " << i + 1 << endl; //i + 1, за да не изпише за първата кола Enter information about car 0
  59.  
  60. cout << "Ime: ";
  61. cin >> otbori[i].ime;
  62. writeOnFile << otbori[i].ime + " ";
  63.  
  64. cout << "vkarani golove: ";
  65. cin >> otbori[i].vkaraniGolove;
  66. writeOnFile << otbori[i].vkaraniGolove + " ";
  67.  
  68. cout << "Dopusnati golove: ";
  69. cin >> otbori[i].dopusnatiGolove;
  70. writeOnFile << otbori[i].dopusnatiGolove + " ";
  71.  
  72. cout << "Tochki: ";
  73. cin >> otbori[i].tochki;
  74. writeOnFile << otbori[i].tochki + " ";
  75.  
  76. writeOnFile << "\n";
  77.  
  78. }
  79. writeOnFile.close();
  80. }
Advertisement
Add Comment
Please, Sign In to add comment