Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote