i just want to ask, why we need to declare the header on the upper part of our syntax.

Headers provide declarations for the library objects and types you use. C++ requires a declaration to exist, and because it would be a pain (not to mention non-portable) to declare things manually, the headers are provided to make your life easier.

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.