Preview:
if (a != 0) { // Išvengiame dalybos iš nulio
    double x = static_cast<double>(-b) / a;
    cout << "x = " << fixed << setprecision(2) << x << endl;
  } else {
    cout << "Tiesinė lygtis neturi vienintelio sprendinio, nes a = 0." << endl;
  }

  return 0;
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter