Skip to content

manyagupta0209/cpp-algorithm-design-manyagupta0209

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Review Assignment Due Date

C++ Assignment: Solving System of Linear Equations

Objective:

This assignment aims to implement a C++ program that solves linear equations using the Gauss-Jordan elimination method.

Instructions:

Part 1: Program Implementation

  1. Read Input:

    • Read an integer n representing the number of variables from the first line.
    • Read n equations in the form of Ax + By + Cz + ... = k from the next n lines. (Actual format is m A B C D...) where m represents the number of coefficients, A, B, C, D... are the coefficients separated by a space.
  2. Implementation:

    • Implement an algorithm to solve the system of linear equations.
    • Ensure your program handles cases where the system may not have a solution.
  3. Output:

    • If the system of equations is not solvable, output "NO."
    • If the system is solvable, output "YES" and x, y, z, ... values with two decimal places.

Part 2: Submission

Submit the C++ source code file in the GitHub repository, similar to how you submitted the previous assignment.

Additional Tips:

  • Please make sure to implement your solution using the provided theory references.
  • Ensure that your program handles edge cases where the system may not be solvable.

Example:

Input:

3
4 2 1 -1 8
4 -3 4 2 1
4 1 -1 3 6
3 2 3 -1

Output:

YES
2.00 -1.00 3.00

Explanation:

In the given example, the system of equations is solvable. The x, y, and z values are 2.00, -1.00, and 3.00, respectively. The output is formatted with two decimal places. If the system were not solvable, the output would be "NO."

  • Refer to this video and this article for a hint on how to solve this problem.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 100.0%