Hello, guys. I wrote the code to a Quadratic Equations Solver and I'd like for you to run the program and read the source code and give me tips on what I can improve, what is good and what is bad, suggestions, etc. . #include <iostream> #include <locale.h> #include <math.h> #include <cmath> #include <complex> #include <windows.h> #include <conio.h> #include <limits> using namespace std; float a = 0; float b = 0; float c = 0;float x1 = 0; float x2 = 0; double Delta = 0; bool repetir = false; int i = 0; int Sim_ou_Nao = 0; void Instrucoes(bool); … |
+0 forum
2 | ||

So I just finished up a way to solve Standard Form Quadratic Equations, Now I want to code a way to automatically Convert a given Standard Form equation to Vertex Form, or Vertex to Standard. Is it possible due to the fact that you have to get a perfect square binomial? Could you just use the Square Root of h in y = a(x-h)^2+k? I've searched google and elsewhere with no luck finding code for a converter. So I came here for a start. package com.github.geodox.quadraticconverter; import java.util.Scanner; public class QuadraticConverter { public static void main(String[] args) { Scanner s … |
+0 forum
9 | ||

Alright so I'm coding a Quadratic Equation Solver to help with my Math Class. However the teacher requires each calculation to be written out. I have the solver working, however I'm not sure where to start when it comes to printing each step. I know I will need to `System.out.println()` each step. But how does Java interpret the equation? Does it do proper BEDMAS(Brackets, Exponents, Division, Multiplication, Addition, Subtraction)? if(disc == 0) { x1 = (-b+Math.sqrt(Math.pow(b, 2)-4*a*c))/(2*a); System.out.println("One Root Found: " + x1); } else if(disc > 0) { x1 = (-b+Math.sqrt(Math.pow(b, 2)-4*a*c))/(2*a); x2 = (-b-Math.sqrt(Math.pow(b, 2)-4*a*c))/(2*a); //Output Results System.out.println("Two … |
+0 forum
3 | ||

Looking for how to write code to compute for quadratic equation on a vb.net application |
+0 forum
1 | ||

Reusable Code Snippet
Quadratic Equation Solver - C++ Sub-routine Here is my first Code Snippet contribution: a C++ sub-routine that computes the roots of a quadratic equation. Notes: * This sub-routine checks if a = 0. * IF a = 0, then the equation is actually not a quadratic equation; it is a linear equation with one--if any--root. * IF the user misses the output statement alerting the user to this fact, the second root has been explicitly assigend a NaN value so that the result is not mistaken for a number. |
+1 forum
10 | ||

Review for a final and I had a question... You are give a hash function h(x) = x%11 and the size of the hash table is 11. The inputs are 4371,1323,6173,4199,4344,9679,1989. What would the resulting hash table be using quadratic probing. Would I start with 4371 and then do the following (h(x)+i^2)%size = location ? h(x) = 4371mod11 = 4 size = 11 i = ??? Not sure thanks for any help (the book is confusing me even more ). |
+0 forum
3 | ||

Hi, I seem to be having a problem with my code below, which I would like to be able to use to return 2 values from the result of a quadratic equation operation. The eReturn function takes care of negative square root values. I'm not getting any errors back, just both of my results as 0. #include <stdio.h> #include <stdlib.h> #include <math.h> void eReturn() { printf("\nOne or both of your answers is complex.\n"); return; } void QuadFormula(float a, float b, float c) { float x1, x2, y, dis, *d, *e; dis = ((b*b)-(4*a*c)); if (dis<0) eReturn(); else if (dis>0) { … |
+0 forum
3 | ||

Hello...just started learning C and i'm trying to write a program that solves quadratic equations...but every time i compile and run it and enter the 3 variables it crashes. I kept on looking but didn't find anything wrong with it...help? :P [CODE]#include <stdio.h> main(){ int a,b,c; float x1,x2; printf("Please enter a b c: \n"); scanf("%d %d %d",a,b,c); if (a == 1){ x1= (b/2) + sqrt(pow(b/2,2)-c); x2= (b/2) - sqrt(pow(b/2,2)-c); } else { x1= (b+ sqrt(pow(b,2) - 4*a*c))/(2*a); x2= (b- sqrt(pow(b,2) - 4*a*c))/(2*a); } printf("The solutions are: \n%f ja %f",x1,x2); getch(); }[/CODE] |
+0 forum
3 | ||

Wrote this for my college open evening just to give prospective students a taste of python. added a little "information" section just to bulk it out a bit (this section is slightly messy i know). Not sure if it works in command line, definitely works in IDLE but the command line is outdated on the college machines so bugs such as the trailing return (/r on the end of inputs) still apply so it is hard to validate. Hope this is helpful for beginners etc (commented in places so prospective students can at least understand some of what's going on) … |
+0 forum
1 | ||

im trying to write a code that i can input a,b,c and the code will run it in the quadratic formula and give me the answer but i keep getting a error problem import math from math import sqrt print print ("Welcome to the Quadratic Program") print ("--------------------------------") print a=input("Enter a: ") b=input("Enter b: ") c=input("Enter c: ") print print answer=[b+(math.sqrt((b*b)-(4*a*c)))]/(2*a) if answer<0: print ("negative") print answer |
+0 forum
2 | ||

hi in my text book i have this problem. how to program this [ICODE] Define a class Quadratic_int that stores the coefficients of a quadratic polynomial in a dynamically allocated array of integers. Supply the "big three" memory management functions. Use this class to demonstrate (a) the difference between initialization Quadratic_int s; Quadratic_int t = s; and assignment operation Quadratic_int s; Quadratic_int t; s = t; (b) the fact that all constructed objects are automatically destroyed (c) the fact that the copy constructor is invoked if an object is passed by value to a function (d) the fact that the … |
-2 forum
5 | ||

Reusable Code Snippet
PEP8 Quadratic Equations Solver This is hopefully example of properly tested code snippet (fingers crossed). |
+0 forum
3 | ||

Reusable Code Snippet
A C# class to solve a quadratic equation [TEX]Solve an equation of the form Ax^2 + Bx + C = 0.[/TEX] The class is commented, but if you have any questions don't be affraid to ask. You may exercise this class in a console application with the following snippet : [CODE]QuadraticEquation z = new QuadraticEquation(1, 3, 3); z.Solve(); Console.WriteLine("D={0}",z.Discriminant()); Console.WriteLine(z.Root1RealPart); Console.WriteLine(z.Root2RealPart); Console.WriteLine(z.Root1ImagPart); Console.WriteLine(z.Root2ImagPart);[/CODE] |
+0 forum
0 |

The End.