C++ Hello World : C++ beginner tutorial

After setting up your compiler as explained in the previous article How to setup a compiler for modern c++ this post will guide you through creating an hello world program in c++, of course we will go past that you just need to stay tuned!

C++ hello world example

create a new c++ project in your ide then paste the following code.

#include<iostream>

int main(){
std::cout<<"hello world";

}

compile and run and see the magic... but wait it is not all magic, it all follows a principle they call syntax.. ok so we are going to explain

the first line #include<iostream>
is what they call the prepocessor which is just like a message to the compiler, in this case we are telling the comiler to include a library which is used for stream input and output and well a stream is just a flow of byte or say characters. so the iostream library is what you need when you what to input or output characters it contains cout for output and cin for input.
the int main(){} is the program entry point the place where your code begin execution.
std is a namespace just think of namespace like a wrapper of functions for now, so std is a wrapper that contain all c++ standard libraries include cin and cout, believe me there are tons of non standard library for c++ you can use in you code but for now run this code and make sure you understand every line if there are questions or error feel free to ask in the comment section.



Never miss out any of this blog articles, Receive our regular updates by joining our mailing list, connect with us on facebook, follow us on Google+ connect with us on Pinterest, add us on Tumblr, and follow us on Twitter.

Never forget to promote and recommend this post to others, Remember sharing is caring.
For other suggestions and queries that are not related to this post should be forwarded to us through the contact form or better still you can get in touch with us on WhatsApp with this number +2348163702703 or 08119482654.

Enjoy and have fun!

©2017, copyright Ogunleye Peter Opeoluwa
Admin @Idea4novice : Tech Weblog On How Tos, Tips And Tricks
Share on Google Plus

About Ogunleye Peter Kleve

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.

2 Post a Comment/Comments:

  1. Hey excited stuff precise substance your response on.
    tutorial for c++

    ReplyDelete
  2. Very Great.

    http://datemeinfo.blogspot.com
    https://datemeinfo.blogspot.com
    DATE ME
    DATE ME HTTPS

    ReplyDelete