#include <iostream>
int main ()
{
cout <<"***\n";
return 0;
}

just an idea ... it is a short code but anyway it doesn't work (i just started c++ and i have dev c++ 4.9.9.2 c) cout isn't working

Recommended Answers

All 5 Replies

In what way is cout not working? Does the code compile? Do you get an error message? What do you see on screen? Does it run? Does the window it runs in close too fast for you to actually see what happens?

Dev C++ 4.9.9.2 is a terrible choice. Throw Dev C++ 4.9.9.2 away and get something better instead. Options include the most recent version of Dev C++ (Orwell's version), whatever Micrsosoft are giving away at the moment, QT Creator, wxDev-C++; or move away from IDEs and use a simple text editor and compile it yourself from the command line (this is the method I recommend to every beginner but it's not very popular).

I get a red line at cout undeclared . What program you suggest using ?

Right. Your code does not compile, because cout is part of the std namespace. Where did you get that code? namespaces were introduced in 1990 and by 1998 were in the standard.

#include <iostream>
int main ()
{
std::cout <<"***n";
return 0;
}
// let me try
#include <iostream>
using namespace std;

int main()

    cout <<"***\n";
    return 0;
}

// alternativly

#include <iostream>
int main()
{
    std::cout<<"***\n";
    return 0;
}

that is the right way
try
using namespace std;
after iostream statement and it will surely compile....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.