Whenever I am attempting to write a simple program on C++ I getan error message that reads \"cout was not declared in this scope\".Literally every time. This has become frustrating because I haveeven written my code the exact same way as some of my classmateswho got theirs to compile and run with no sign of this error atall, and yet min gives this answer. I will leave an example of acode where this error message appeared. Hopefully you can help.Thank you.
ex:
// Example program
#include
#include
int main()
{
double mass, velocity,energy;
cout<<\"\n enter the objects weight\";
cin>>mass;
cout<<\"\n enter the objects velocity\"
cin>>velocity;
energy=(1.0/2.0)*(mass*velocity)*2;
cout<<\"\n mass = \"<cout<<\"\n velocity = \"<cout<<\"\n kinetic energy =\"<}
Here's the error message:
In function 'int main()': 8:1: error: 'cout' was not declared inthis scope 8:1: note: suggested alternative: In file included from2:0: /usr/include/c++/4.9/iostream:61:18: note: 'std::cout' externostream cout; /// Linked to standard output ^ 9:1: error: 'cin' wasnot declared in this scope 9:1: note: suggested alternative: Infile included from 2:0: /usr/include/c++/4.9/iostream:60:18: note:'std::cin' extern istream cin; /// Linked to standard input ^