Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9231397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:03:26+00:00 2026-06-18T06:03:26+00:00

Hello I’m having trouble writing a solution code for my homework. I am required

  • 0

Hello I’m having trouble writing a solution code for my homework. I am required to ask the user to input 6 variable for two equations. After successfully pulling numbers only, I need to find the slope of each line, the y-intercept for each line, two points on each line(ordered pair such as (2,1)), if there is a solution. Also what the relationship is. I have searched and searched for mostly number checking and equations. What I am having trouble with is finding the points and solutions to the equations.

#include <iostream>
#include <limits>

int main()
{
std::cout<<"This program is designed to test two linear equations. \n";
std::cout<<"In order to best solve the system, \n";
std::cout<<"equations will be in the form of a*x + b*y = c. \n";
std::cout<<"and d*x + e*y =f. \n";
std::cout<<"Please enter an integer for a, b, and c. \n";
double a, b, c, d, e, f;

while ((std::cout << "Enter a.") 
     && !(std::cin >> a))
{
    std::cout << "That's not a number ";
    std::cin.clear();
    std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
}
while ((std::cout << "Enter b.")
          && !(std::cin >> b))
{
    std::cout << "That's not a number ";
    std::cin.clear();
    std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
}
while ((std::cout << "Enter c.")
          && !(std::cin >> c))
{
    std::cout << "That's not a number ";
    std::cin.clear();
    std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
}
std::cout<<"Equation 1 is "<<a<<"x +"<<b<<"y ="<<c;

std::cout<<"Please enter an integer for d, e, and f. \n";

while ((std::cout << "Enter d.")
         && !(std::cin >> d))
{
    std::cout << "That's not a number ";
    std::cin.clear();
    std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
}
while ((std::cout << "Enter e.")
          && !(std::cin >> e))
{
    std::cout << "That's not a number ";
    std::cin.clear();
    std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
}
while ((std::cout << "Enter f.")
          && !(std::cin >> f))
{
    std::cout << "That's not a number ";
    std::cin.clear();
    std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
    }
    std::cout<<"Equation 2 is "<<d<<"x +"<<e<<"y ="<<f;

    double slope1, slope2;
    double x1, x2, y1, y2;
    slope1 = (b / a);
    slope2 = (e / d);
    std::cout<<" Slope of Equation 1 is "<<slope1<<"\n";
    std::cout<<" Slope of Equation 2 is "<<slope2<<"\n";

    x1 = ((c*e)-(b*f))/ ((a*e)-(b*d));
    y1 = ((a*f)-(c*d))/ ((a*e)-(b*d));

    return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:03:27+00:00Added an answer on June 18, 2026 at 6:03 am

    Something else you should think about is the use of matrices to solve linear equations.

    A lot of comptuers use calculations on the echelon form of an augmented matrix.

    ie.

    2x + 3y = 36  
     x + 9y = 8  
    
    [2 3 36]  
    [1 9 8]  
    

    So this is your augmented matrix and then you work on it to transform it into echelon form. My linear algebra professor tells me that this is the most common method that programmers use to write calculations on systems of equations.

    I’m not exactly qualified to teach it so here is a nifty article.

    http://stattrek.com/matrix-algebra/echelon-form.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello all I am working on javascript jquery and svg.I want to ask a
Hello all I am working on html and javascript.And I am going to ask
Hello I have like this 2 tables class User public int UserId{get;set;} { ....
Hello I use the following code in order to retrieve an events infoormation from
Hello i am looking for a very basic (lightweight) jquery lightbox solution that i
Hello and thanks for the help. I am using the following code to set
Hello I am using this code to get the data I need from 5
Hello i am newbie in php I am having a simple php error I
Hello! I have this trouble: I'm searching reports by date and in html view
Hello everyone how can I get two values from different select boxes? I get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.