C++ :: Two Solutions For X And Y

May 7, 2014

I'm trying to write a code that will give me two solutions one for x and one for y.

The equation is the following x^2+4=y^3

The solution for y is y=(x^2+4)^1/3

The solution for x is x=(y^3+4)^1/2

The answer needs to printed like that in upper section. I've written a bad code, cause I'm not good at programing. But never the less it's a start, i think.

#include <iostream>
using namespace std;
int main () {
int a; //replaceable
int b; //replaceable
int ind_a=2; //upper index of a
int ind_b=3; //upper index of b

[code] .....

View 1 Replies


ADVERTISEMENT

C :: Calculate The Solutions Of Quadratic Equations

Oct 22, 2014

I have a task to find errors in this long line of code in order to correctly calculate the solutions of quadratic equations.

Code:
int main(int argc, char *argv[]) {
int validInput, solution_type;
double a, b, c, root_1, root_2, q;

/***********************
* Input / Validation
***********************/

/* Check numbers of arguments, and read input */
validInput = (argc = 4);

[Code] ....

Is a section of the code (the first section). And as you can probably guess, it goes on to calculate for a > 0 etc...

I dont really understand what the validinput section is saying? And a, b and c are never defined so Xcode is just saying a,b,c,root1,root2 are uninitialized and I also dont know what means. Do I need to define these values?

Code:
int main(int argc, char *argv[]) {
int validInput, solution_type;
double a, b, c, root_1, root_2, q;

[Code] ......

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved