engr1hw1 - 4 a 1 There is no in front of...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Engineering 001 – HW1 1) a) x4= 13.44 b) x4= -1.14953 c) x4= 15.3349 d) x4= 5.15971 e) c= 3 f) c= 0 g) c= 1 h) b= 2 i) x2= 5.0061 2) a.) net$ - Not a valid name because the “$” symbol cannot be used b.) w_width - Valid name c.) final-h – Not a valid name because the “-” symbol cannot be used d.) high score – Not a valid name because you cannot have spaces in a variable name e.) 4xx – Not a valid name because you cannot begin a variable name with a number f.) mYbesTguesS – Valid name 3) a) x=pow(h-2,3); b) z=(m+3)/cos(n); c) c=sqrt(pow(a,2)+pow(b,2)); d) x1= (-b + sqrt(pow(b,2) – 4*a*c))/(2*a); e) y= tan(x)/(17*x) + exp(x);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 4) a) 1) There is no # in front of include <iostream>. 2) There are “” in place of “{}” in order to show the boundaries of main(). 3) When defining the variable total, double is misspelled as doub. 4) There is no “;” at the end of the line defining the variable int n. 5) In order to raise 3.1 to the power of “total”, you must write it as pow(3.1,total), not as 3.1^total. 6) In the cout line, the arrows are pointing the wrong direction. They should be << not >>. The new output of the program is “n is equal to 48”...
View Full Document

This note was uploaded on 09/08/2008 for the course ENGR 001 taught by Professor Dr.smith during the Spring '08 term at Lehigh University .

Ask a homework question - tutors are online