Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.97 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <fstream>
  4. #include <iomanip>
  5.  
  6. using namespace std;
  7.  
  8. struct Mokinys
  9. {
  10.     string pav;
  11.     int kiek;
  12. };
  13.  
  14. void Skaityti(Mokinys A[], int &n)
  15. {
  16.   ifstream fd("duom.txt");
  17.   fd >> n;
  18.   for (int i = 0; i < n; i++)
  19.   {
  20.   fd >> A[i].pav >> A[i].kiek;
  21.   }
  22.   fd.close();
  23. }
  24.  
  25. void Spausdinti(Mokinys A[], int n, string eil)
  26. {
  27.     cout << eil << endl;
  28.     cout << "________________________" << endl;
  29.     cout << "   Vardas     Taškai    " << endl;
  30.     cout << "________________________" << endl;
  31.     for (int i = 0; i < n; i++)
  32.     {
  33.     cout << "  " << setw(15) << left << A[i].pav << "   " << setw(10) << A[i].kiek << endl;
  34.     cout << "________________________" << endl;
  35.     }
  36. }
  37.  
  38. void Atrinkti()
  39. {
  40.  
  41. }
  42.  
  43. void Suma()
  44. {
  45.  
  46. }
  47.  
  48.  
  49. int main()
  50. {
  51.   setlocale (LC_ALL, "Lithuanian");
  52.   string eil = "Klasės mokinių sąrašas";
  53.   int n = 0;
  54.  
  55.   Mokinys A;
  56.   Skaityti(A, n);
  57.   Spausdinti(A, n, eil);
  58.  
  59.  
  60. return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement