User forums > Using Code::Blocks

cout was not declared in this scope error

(1/1)

new.programmer:
#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?

stahta01:
Read this FAQ http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
I suggest reading the others and finding a C++ book or support website.

Edit: C++ Website http://cboard.cprogramming.com/cplusplus-programming/

Tim S.

Jenna:
Topic locked, because it violates our forum rules!

Navigation

[0] Message Index

Go to full version