so i have this question to do and i don't no where to start is someone could help me!!!
Write a complete C++ program that prompts the user for the x and y coordinates of two Cartesian points, then calculates and displays the distance between them. Assume that the coordinate values are whole numbers. The distance between two points having the coordinates (x1, y1) and (x2, y2) is distance = the square root of ([x1 - x2]2 + [y1 - y2]2 ).
First, you need to get the two XY point values with cin. Then, you can use the functions in math.h to do the math for you. Finally, you just print out the result. Don't expect to get anyone to write the program for you, we won't.
well for one i wasnt asking anything to do my work...i was asking if someone could help me get a head start considerin i never done anything like this nor had any experiince with c++ i was just asking for a helping hand
struct coordinates // structure for coordinates
{
int x;
int y;
}point1, point2; // two points x1,y1 & x2,y2
void read(coordinates &pt) // function to read values
{
cout<<"Enter the value for x coordinate";
cin>>pt.x;
cout<<"Enter the value for y coordinate";
cin>>pt.y;
}
void main()
{
clrscr();
float distance;
read(point1);
read(point2);
distance=sqrt(((x1 - x2)*(x1 - x2)) + ((y1 - y2)*(y1 - y2)));
cout<<" Distance between the two coordinates is"<<distance;
getch();
}
Wow people...
So, how is jade777 going to learn how to program in c++ if everyone just does the work for him? Sure, I could have spent 20 minutes programming this, but I wouldn't have because the purpose of homework is to LEARN!!!!!
buddy relax..i wasnt even like asking someone to do my homework i simply asked a question one i didnt even use his code i did it on my own...i was askin for a guide start..ya u can do it in 20 10 3 mins for all i care..i simply asked i wasnt like give me the answer or else so before u accuse me on anything...this site is for people to read a post and reply if they can help someone else ya i am new to this and some things im not as fast as other people at least im trying ok
@jade777:
When one of us goes off on a rampage against posting full solutions (aka. doing homework for someone), we're usually not accusing the original poster of asking for a full solution. However, our point is valid: how are you going to learn if someone else does all the work for you? Everyone else: do not post full solutions, unless they contain some obscure syntax error. In fact, not even then...
well in my topic i didnt say can someone please post the full soultion they did it on there own i didnt beg...i simply just posted what my question so it be easier for one to understand what another person is asking...im not trying to cause "drama" but seriously obviously i am learning if i wasn't why am i in school for? clearly i wanna be successful and i no not everyone will always be like ok here u go obviously i no i have to try ...sometimes when ppl explain things its harder so i just posted a question and it wasnt even the full thing but thanks for attacking me
p.s Albatross the only reason why u think im on the defence with this is because u dont even no who i am so udont no what my situtation is....this is a site where ppl come talk bout C++ or w.e to programmin so i figured why not start somewhere :) so lets not be mean
We are not attacking you. We are actually trying to defend you. When I first replied, it sounded to me as if you were asking someone to write a program for you, so I apologize for accusing you of wanting a full solution. I am very happy that you decided to write your own program.
well its just the way someone says something Vexter obviously its harder cause its on computer and no one knows how someone else is saying it i didnt mean to be rude nor anything to you or anything i just didnt want ppl to think im using ppl to get answers obviously i no i have to do it myself cause when it comes to a test or a exam its gunna be how much knowledge i no i guess its just the misunderstanding im just a girl tryin to do well in this lol its a hectic sesmster
Okay, I'm going to have to ask everyone to go punch their nearest boy/girlfriend and come back after they've calmed down a bit. That didn't calm you down? What the heck?...
@Vexter: I second that we are trying to defend jade777's future, rather than bring it crashing around her ears. Okay, maybe you're not quite saying that, but I am. We're on more or less the same page, right?
@jade777: What makes you think I think you're on the defense? Because... you don't know me. *wink*
I recommend that you relax, stretch out, have a cookie, and look at this situation again. I accept the fact you had no intention of being rude or mean, in fact (and this is just a guess), you just seem a little bit stressed out. Again: relax, stretch out, the like. You can't write a program if your hair is in a tangle (believe me, I know). :)
And as for requiring you to work... trust us, it's for your own good.
to whom ever you people are i want to thank you for understanding..ya you are kind right albatross im a little stressed right now you don't even no me and you are right today was just a very bad day work school work...story of my life it gets crazy and i get freaked out so easily and thats when i just give up so0o maybe we all can help each other :)