fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. typedef struct {
  5. short width;
  6. short height;
  7. short left;
  8. short top;
  9.  
  10. int S;
  11. short orientation;
  12. } Rectangle;
  13.  
  14. bool input_rectangle(Rectangle* rect) {
  15. short width;
  16. short height;
  17.  
  18. std::cin >> width >> height;
  19.  
  20. (*rect).width = width;
  21. (*rect).height = height;
  22. (*rect).S = width * height;
  23.  
  24. (*rect).top = 0;
  25. (*rect).left = 0;
  26.  
  27. if(width>height) {
  28. (*rect).orientation = 100;
  29. }
  30. else {
  31. (*rect).orientation = 100;
  32. }
  33.  
  34. return width!=0 || height!=0;
  35. }
  36.  
  37. int main() {
  38. Rectangle* rectangles = new Rectangle[10];
  39. for(int i=0;i<10;i++)
  40. input_rectangle(&rectangles[i]);
  41.  
  42. for(int i=0;i<10;i++)
  43. std::cout << rectangles[i].width << " x " << rectangles[i].height << " = " << rectangles[i].S << "\n";
  44. }
Success #stdin #stdout 0s 3476KB
stdin
4 16 6 6 5 10
stdout
4 x 16 = 64
6 x 6 = 36
5 x 10 = 50
5 x 10 = 50
5 x 10 = 50
5 x 10 = 50
5 x 10 = 50
5 x 10 = 50
5 x 10 = 50
5 x 10 = 50