Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.26 KB | None | 0 0
  1. //---------------------------------------------------------------------------
  2. #include <iostream.h>
  3. #include <iomanip.h>
  4. #include <stdio.h>
  5. #include <vcl.h>
  6. #pragma hdrstop
  7.  
  8. //---------------------------------------------------------------------------
  9.  
  10. #pragma argsused
  11. struct sotrudnik
  12. {
  13. char fio[50];
  14. int nomer;
  15. double chas;
  16. double tarif;
  17. };
  18.  
  19. int main  ()
  20. {
  21. FILE*lol
  22. int n,i;
  23.  
  24.  
  25. lol=fopen("1.txt",w);
  26. puts("Vvedite chislo rabochij: ");cin>>n;
  27. sotrudnik *a=new sotrudnik[n];
  28.    
  29. for(i=0;i<n;i++)
  30. {
  31.     cout<<"Vvedite dannye sotrudnika "<<i+1<<":"<<endl;
  32.     puts("FIO: ");cin>>(a[i].fio);
  33.     puts("Tabelnuy nomer: ");cin>>a[i].nomer;
  34.     puts("Otrabotanuj chasov: ");cin>>a[i].chas;
  35.     puts("Tarif: ");cin>>a[i].tarif;
  36. }
  37. for(i=0;i<n;i++)
  38. {
  39.     cout<<setw(30)<<a[i].fio<<setw(5)<<a[i].nomer<<setw(15);
  40.     if(a[i].chas>144)
  41.         cout<<a[i].tarif*(2*a[i].chas-144)*0.88;//a[i].tarif*144+2*a[i].tarif*(a[i].chas-144)*(1-0.12)
  42.     else
  43.         cout<<a[i].tarif*a[i].chas*0.88;
  44.     cout<<endl;
  45. }
  46. for(int i=0;i<n;i++)
  47. {
  48.     fprintf(lol, "%s\n",a[i].fio);
  49.     fprintf(lol, "%s\n",a[i].nomer);
  50.     fprintf(lol, "%s\n",a[i].chas);
  51.     fprintf(lol, "%s\n",a[i].tarif);
  52. }
  53. fclose(lol);
  54. system ("pause");
  55. return 0;
  56. }
  57. //---------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement