Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.03 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. 2
  4.  
  5. using namespace std;
  6. 3
  7.  
  8. struct dreptunghi{
  9. 4
  10.  
  11. int l,L,a,p;
  12. 5
  13.  
  14. }v[100];
  15. 6
  16.  
  17. int n,amax,pmin;
  18. 7
  19.  
  20. int main()
  21. 8
  22.  
  23. {
  24. 9
  25.  
  26. cout<<"n=";
  27. 10
  28.  
  29. cin>>n;
  30. 11
  31.  
  32. for(int i=0;i<n;i++)
  33. 12
  34.  
  35. {
  36. 13
  37.  
  38. cout<<"latimea=";
  39. 14
  40.  
  41. cin>>v[i].l;
  42. 15
  43.  
  44. cout<<"lungimea=";
  45. 16
  46.  
  47. cin>>v[i].L;
  48. 17
  49.  
  50. v[i].a=v[i].l*v[i].L;
  51. 18
  52.  
  53. v[i].p=2*(v[i].l+v[i].L);
  54. 19
  55.  
  56. }
  57. 20
  58.  
  59. ///Afisarea datelor citite:
  60. 21
  61.  
  62. for(int i=0;i<n;i++)
  63. 22
  64.  
  65. cout<<v[i].l<<" "<<v[i].L<<" "<<v[i].a<<" "<<v[i].p<<endl;
  66. 23
  67.  
  68. amax=v[0].a;
  69. 24
  70.  
  71. pmin=v[0].p;
  72. 25
  73.  
  74. for(int i=1;i<n;i++)
  75. 26
  76.  
  77. {
  78. 27
  79.  
  80. if(v[i].a>amax)
  81. 28
  82.  
  83. amax=v[i].a;
  84. 29
  85.  
  86. if(v[i].p<pmin)
  87. 30
  88.  
  89. pmin=v[i].p;
  90. 31
  91.  
  92. }
  93. 32
  94.  
  95. cout<<amax<<" "<<pmin<<endl;
  96. 33
  97.  
  98. for(int i=0;i<n;i++)
  99. 34
  100.  
  101. {
  102. 35
  103.  
  104. if(v[i].a==amax)
  105. 36
  106.  
  107. cout<<"Dreptunghi cu arie max.:"<<v[i].l<<" "<<v[i].L<<endl;
  108. 37
  109.  
  110. if(v[i].p==pmin)
  111. 38
  112.  
  113. cout<<"Dreptunghi cu perimietru min.:"<<v[i].l<<" "<<v[i].L<<endl;
  114. 39
  115.  
  116. }
  117. 40
  118.  
  119. return 0;
  120. 41
  121.  
  122. }
  123.  
  124. 1
  125.  
  126. #include <iostream>
  127. 2
  128.  
  129. #include <cmath>
  130. 3
  131.  
  132. using namespace std;
  133. 4
  134.  
  135. struct dreptunghi
  136. 5
  137.  
  138. {
  139. 6
  140.  
  141. int l,L;
  142. 7
  143.  
  144. double diag;
  145. 8
  146.  
  147. }v[50];
  148. 9
  149.  
  150. int n;
  151. 10
  152.  
  153. double d;
  154. 11
  155.  
  156. int main()
  157. 12
  158.  
  159. {
  160. 13
  161.  
  162. cout << "n=";
  163. 14
  164.  
  165. cin>>n;
  166. 15
  167.  
  168. cout<<"d=";
  169. 16
  170.  
  171. cin>>d;
  172. 17
  173.  
  174. for(int i=0;i<n;i++)
  175. 18
  176.  
  177. {
  178. 19
  179.  
  180. cout<<"latimea=";
  181. 20
  182.  
  183. cin>>v[i].l;
  184. 21
  185.  
  186. cout<<"Lungimea=";
  187. 22
  188.  
  189. cin>>v[i].L;
  190. 23
  191.  
  192. v[i].diag=sqrt(v[i].l*v[i].l+v[i].L*v[i].L);
  193. 24
  194.  
  195. if(v[i].diag==d)
  196. 25
  197.  
  198. cout<<"Rezultat:"<<v[i].l<<" "<<v[i].L<<endl;
  199. 26
  200.  
  201. }
  202. 27
  203.  
  204. return 0;
  205. 28
  206.  
  207. }
  208. 29
  209.  
  210.  
  211. 1
  212.  
  213. #include <iostream>
  214. 2
  215.  
  216. using namespace std;
  217. 3
  218.  
  219. struct punct{
  220. 4
  221.  
  222. int x,y,cadran;
  223. 5
  224.  
  225. }a[30];
  226. 6
  227.  
  228. int n;
  229. 7
  230.  
  231. int main()
  232. 8
  233.  
  234. {
  235. 9
  236.  
  237. cout << "n=";
  238. 10
  239.  
  240. cin>>n;
  241. 11
  242.  
  243. ///Citire abs., ord. si det. cadran
  244. 12
  245.  
  246. for(int i=0;i<n;i++)
  247. 13
  248.  
  249. {
  250. 14
  251.  
  252. cout<<"x=";
  253. 15
  254.  
  255. cin>>a[i].x;
  256. 16
  257.  
  258. cout<<"y=";
  259. 17
  260.  
  261. cin>>a[i].y;
  262. 18
  263.  
  264. if(a[i].x>0 && a[i].y>0)
  265. 19
  266.  
  267. a[i].cadran=1;
  268. 20
  269.  
  270. if(a[i].x<0 && a[i].y>0)
  271. 21
  272.  
  273. a[i].cadran=2;
  274. 22
  275.  
  276. if(a[i].x<0 && a[i].y<0)
  277. 23
  278.  
  279. a[i].cadran=3;
  280. 24
  281.  
  282. if(a[i].x>0 && a[i].y<0)
  283. 25
  284.  
  285. a[i].cadran=4;
  286. 26
  287.  
  288. }
  289. 27
  290.  
  291. cout<<"Cardanul I:"<<endl;
  292. 28
  293.  
  294. for(int i=0;i<n;i++)
  295. 29
  296.  
  297. if(a[i].cadran==1)
  298. 30
  299.  
  300. cout<<a[i].x<<" "<<a[i].y<<endl;
  301. 31
  302.  
  303. ///cout<<"Cadranul II:"<<endl;
  304. 32
  305.  
  306. ///for()
  307. 33
  308.  
  309. ///==2
  310. 34
  311.  
  312. return 0;
  313. 35
  314.  
  315. }
  316. 36
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement