Which of the following are errors in the following program? An error may be syntax, logic, or even style (indention,
spacing, identifiers, etc.).
1 2 3 4
|
#include<iostream>
using namespace std;int main(){int x,y,z;double w;cin>>
x;y=x/12;z=x%12;w=x/12.0;cout<<x<<’=’<<y<<’&’<<z<<’(’<<w<<’)’
<<endl;return 0;}
|
A) spacing is needed around operators
B) change int variables to double
C) add comments
D) make 12 a short constant
E) wrap any long lines properly
F) change single quotes to double quotes
G) prompt before cin
H) clean up labeling on results
I) typecast on w calculation
J) indent lines between { and }
K) void in main’s ()
L) blank lines between logical sections/at logical
breaks
M) fix variable names (it’s an inches conversion program)
N) change int variables to short or long
O) join last three lines and then break after ;, {, }, and
() of main
If the user enters 43, what will the program produce (as currently written)?