Thread: solve linear equation

  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    10

    solve linear equation

    Hello ,

    I'm pretty new in C++ programming, and i just have received new mission:

    Write a program to solve the linear equation ax + b = 0

    The problem is that i can't understand what exactly i have to do?
    Maybe with example i will...

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Do you know how to solve it if you were given this question in a maths exam?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Nov 2008
    Posts
    10

    no

    Quote Originally Posted by laserlight View Post
    Do you know how to solve it if you were given this question in a maths exam?
    no i don't

  4. #4
    Registered User valaris's Avatar
    Join Date
    Jun 2008
    Location
    RING 0
    Posts
    507
    I believe -b/a will be your solution. So try writing that in C++.

  5. #5
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Quote Originally Posted by valaris View Post
    I believe -b/a will be your solution. So try writing that in C++.
    Ah, well that depends on what variables you're solving for
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How do I solve this logarithmic equation?
    By unicorn in forum C Programming
    Replies: 10
    Last Post: 01-17-2008, 05:47 AM
  2. Linear Programming
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 12-20-2007, 09:53 PM
  3. Logical errors with seach function
    By Taka in forum C Programming
    Replies: 4
    Last Post: 09-18-2006, 05:20 AM
  4. Linear Equation Solver
    By EvilGuru in forum C++ Programming
    Replies: 7
    Last Post: 10-22-2005, 10:10 AM
  5. IDEA: Equation solver
    By Magos in forum Contests Board
    Replies: 2
    Last Post: 01-07-2003, 11:46 AM