Getting errors in the program seems like I\'m missing something any ideas to get
ID: 3663533 • Letter: G
Question
Getting errors in the program seems like I'm missing something any ideas to get it to complie?
error: expected constructor, destructor, or type conversion before '<' token
expected `;' before '<' token
code text
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double x,y;
/* Read in angle in radians */
cout << "Enter angle (radians): ";
cin >>x;
/* Compute sin(x) */
y = sin(x);
cout << "sin(x) = "<< y;
cout << "sin(x) + sin(x)*sin(x) = " << y +y*y<<endl;
cout << "The square root of (1+sin(x)) = " <<sqrt(1+y) << endl;
return 0;
}
Explanation / Answer
Following code is working
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double x,y;
/* Read in angle in radians */
cout << "Enter angle (radians): ";
cin >>x;
/* Compute sin(x) */
y = sin(x);
cout << "sin(x) = "<< y;
cout << "sin(x) + sin(x)*sin(x) = " << y +y*y<<endl;
cout << "The square root of (1+sin(x)) = " <<sqrt(1+y) << endl;
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.