Author Topic: cout was not declared in this scope error  (Read 19665 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: 7678
    • 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 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7256
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!