Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <fstream>
  4. using namespace std;
  5. const int n=1;
  6. struct Dane
  7. {
  8. string marka;
  9. int vin, cena;
  10. };
  11.  
  12. void tab1(Dane t[n][n])
  13. {
  14. for(int i=0;i<n;i++)
  15. {
  16. for(int j=0;j<n;j++)
  17. {
  18. cout<<"Podaj marke:"<<endl;
  19. cin>>t[i][j].marka;
  20. cout<<"Podaj Vin:"<<endl;
  21. cin>>t[i][j].vin;
  22. cout<<"Podaj cena:"<<endl;
  23. cin>>t[i][j].cena;
  24. }
  25. }
  26. }
  27.  
  28. void drukuj1(Dane t[n][n])
  29. {
  30. for(int i=0;i<n;i++)
  31. {
  32. for(int j=0;j<n;j++)
  33. {
  34. cout<<t[i][j].marka<<"\t"<<t[i][j].vin<<"\t"<<t[i][j].cena<<"\t"<<endl;
  35. }
  36. }
  37. }
  38. int minn(Dane t[n][n],int min)
  39. {
  40. min=t[0][0].cena;
  41. for(int i=0;i<n;i++)
  42. {
  43. for(int j=0;j<n;j++)
  44. {
  45. if(min>t[i][j].cena)
  46. {
  47. min=t[i][j].cena;
  48.  
  49. }
  50. }
  51. cout<<min;
  52. }
  53. return min;
  54. }
  55.  
  56. void zwieksz(Dane t[n][n],double srednia)
  57. {
  58. for(int i=0;i<n;i++)
  59. {
  60. int j=0;
  61. srednia=0;
  62. srednia=(srednia+t[i][j].cena)/n;
  63. if(srednia<t[0][j].cena)
  64. {
  65. t[i][j].cena=t[i][j].cena+min;
  66. }
  67.  
  68. }
  69. }
  70.  
  71. void trab(Dane t[n][n])
  72. {
  73. for(int i=0;i<n;i++)
  74. {
  75. for(int j=0;j<n;j++)
  76. {
  77. if(t[i][j].marka="trabant")
  78. {
  79. t[i][j].cena=1000000;
  80. }
  81. }
  82. }
  83. }
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103. int main()
  104. {
  105. Dane a[n][n];
  106. tab1(a);
  107. drukuj1(a);
  108. cout<<endl;
  109. cout<<endl;
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130. return 0;
  131. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement