Contains the source code from the course work throughout my undergraduate Computer Engineering degree at Brigham Young University. There is a mixture of Go, Python, C, C++, Java, VHDL, Verilog, Matlab, Bash, Assembly, etc..
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

#### 43 lines 1.4KB Raw Blame History

 ``````//Derek McQuay 647465151 CS 235 Fall 2012 midterm 1 #include "node.h" node::node(const int exponent, const int coefficient, const char variable, node* next) : exponent(exponent), coefficient(coefficient), variable(variable), next(next) {} node::node(const int exponent, const char variable, node* next) : //construtor for when coefficient is assumed 1 exponent(exponent), coefficient(1), variable(variable), next(next) {} ostream & operator<<(ostream & os, node n) { //used to correctly print out each node if(n.coefficient == 0) { os << ""; } else if(n.coefficient == 1 && n.exponent == 0) { os << n.coefficient; } else if(n.coefficient == -1 && n.exponent == 0) { os << n.coefficient; } else if(n.exponent == 0) { os << n.coefficient; } else if(n.coefficient == -1) { os << "-" << n.variable << " ^ " << n.exponent; } else if(n.coefficient < 0 && n.exponent == 1) { os << n.coefficient << n.variable; } else if(n.coefficient == 1 && n.exponent == 1) { os << n.variable; } else if(n.exponent == 1) { os << n.coefficient << " " << n.variable; } else if(n.coefficient == 1) { os << n.variable << " ^ " << n.exponent; } else { os << n.coefficient << " " << n.variable << " ^ " << n.exponent; } return os; }``````