Author Topic: cout was not declared in this scope error  (Read 15214 times)

new.programmer

  • Guest
cout was not declared in this scope error
« on: May 20, 2014, 08:20:24 pm »
#include<iostream>
int main()
{
    cout << "a= ";
    double a;
    cin >> a;

    cout "b= ";
    double b;
    cin >> b;
 
    double p;
    p=2*(a+b);

    double s;
    s=a*b;
 
    cout << "p= " << p << "\n";
    
    cout << "s= " << s << "\n";
    return 0;
}

I get the following error: line 5 'cout' was not declared in this scope, how to fix it?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6661
    • My Best Post
Re: cout was not declared in this scope error
« Reply #1 on: May 20, 2014, 08:57:03 pm »
« Last Edit: May 20, 2014, 09:58:47 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: cout was not declared in this scope error
« Reply #2 on: May 20, 2014, 10:47:14 pm »
Topic locked, because it violates our forum rules!