Question

Problem 3: Write a program that asks the user the slope and y-intersect of one line y a12+bi, the slope and y-intersect of a second line y = a2x+b2. The program returns the point of intersection of the two lines, if it exists. Otherwise, the program must print a message to indicate that the two lines do not have a point of intersection. Recall that, if it exists, the point of intersection (20%) of two lines y aix + b1 and y = a2x+ b2 is such that a1-a2 and Also, recall that two lines are parallel (and thus do not intersect) if they have the same slope. For this program you may choose your own user prompt and printed messages
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Program is in C++

#include<iostream>

using namespace std;

main()

{

float a1,a2,b1,b2;

cout<<"Enter slope and y intersect of line1";

cin>>a1>>b1;

cout<<"Enter slope and y intersect of line 2";

cin>>a2>>b2;

if(a1==a2) //checking if lines are parallel

cout<<"Line are parallel and they wont intersect"

else

{

cout<<"They will intersect at"

x=( ( b2 - b1) / ( a1 - a2 ));

y = a1*x+b1;

cout<<x<<" "<<y;

}

}

Add a comment
Know the answer?
Add Answer to:
Write a program that asks the user the slope and y-intersect of one line y =...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT