15,946,074 members
See more:
Given two coordinates in a rectangle "ABCD", you are asked to calculate the other two coordinates.
Input

The first line contains four space-separated integers x1, y1, x2, y2 (-100 ≤ x1, y1, x2, y2 ≤100), (x1 ≠ x2 and y1 ≠ y2), where (x1,y1) and (x2,y2) are point D,B or B,D.
Output

Print the four coordinates in this format "(Ax,Ay)(Bx,By)(Cx,Cy)(Dx,Dy)" without the quotes.
Posted
PIEBALDconsult 15-Nov-14 14:27pm
Member 11236589 20-Nov-14 5:56am
yes.but i face problems to solve it
Zoltán Zörgő 15-Nov-14 15:51pm
"I want..."
Sorry, but nobody will jump on this...
Nelek 15-Nov-14 15:58pm

## Solution 1

This is not how CP usually works. Most important goal here is to learn and help learning.
You are supposed to try it on your own, and come here when you got stuck with something, with a concrete question about your code, design, etc.
Please have a look to What have you tried?[^] to see a good explanation about what I mean.
Don't forget people here don't get payed. And besides, if we give you a ready-to-go solution, it is not going to help you because you are not going to learn anything from it.

As general approach:
Step 1) Do a little research. Google is a good start point
Step 2) Start coding
Step 3) Compile and use the debug to solve little issues
Step 4) When you get a problem you don't know how to solve but at least you tried it, then come back and ask for something concrete with a snippet of the code giving problems

P.S. Written as solution to avoid this "question" to be in the unanswered list. If it gets improved, please drop a comment and I will edit or delete this message

## Solution 2

Please let your teacher know that the problem is incorrectly stated. A rectangle is not fully determined by two of its corners. It needs in addition either:

- the rotation angle
- or the width
- or the height.

Your teacher was probably referring to a rectangle with rotation angle 0. But he or she should then have stated this in your homework. If this is so, this is a really simple task. Take a minute or two and you will be able to solve it yourself. That is way better than to copy an answer from a website. You might learn something on the way, which seems not the worst idea.

Member 11236589 20-Nov-14 6:04am
i certainly tried and think of that problem then write a code but didn't run
PIEBALDconsult 20-Nov-14 8:26am
Well show it then. Use the Improve question button to add it.