100 days of cplus plus c++

100 Days Of C++ | Day 1

Welcome to Day One

This tutorial is beginner-friendly. At the end of the challenge, you would be able to write, compile and debug programs in c++. we would do 10 capstone projects that you can share on your profile.

Happy Coding!

Table of Content

A Little History


C++ was built by Bjarne Stroustrup in 1979 while working at AT&T Bell Labs.

Bjarne during a Ph.D. thesis worked with Simula a language that supports object-oriented paradigm.
his goal was to design a language that maintained the efficiency of C and the flexibility objected-oriented paradigm offered.

This work was first known as C with Classes. it was later renamed C++ in 1983.

C++ is a powerful language used in millions of platforms. Some examples are Game development, desktop applications, Artificial Intelligence systems and platforms, E-commerce, Robotics, Web browsers e.t.c

The knowledge of C++ helps you understand better memory management and other techniques that support efficiency.
you can write code that interacts directly with the hardware of a computer (how cool is that )

Learning C++ exposes you to the architecture of a computer.

In our capstone projects, we would write a program that runs on the Arduino board and controls a machine to perform a certain task. See project full list below

List of our capstone projects

a. Game development with C++ ( 4 projects)
b. Control a Robot with C++ (2 projects )
c. Home automation with C++ ( 2 projects )
d. Code a music box with C++ (2 projects)

Install an IDE.

Follow this link to install Visual Studio on your computer.

Hello World

Let’s start by writing our first program

Open Visual Studio, On the dialog box select > Create a new project

Select Console App and click on Next

100 days of c++

Choose a project name and create

Copy and paste the code below in your IDE

#include "pch.h" 
#include <iostream>

int main()
{

std :: cout <<"Hello World My First C++ Program";
return 0;

} 
  

To run the code, click on Debug on the menu bar and select Start without Debugging (Ctrl + F5)

A dialog box would pop asking if you want to build, select Yes

After a successful build, “visual studio debug console” would pop up displaying your text Hello world My First C++ Program

Mr. Owl

Copy and Paste the code below, build and run the program

#include "pch.h" 
#include <iostream>
using namespace std;

int main()
{
		cout << " _____" << endl;
		cout << "( @ @ ) MR OWL is watching you code" << endl;
		cout << "   '  " << endl;

  return 0;

}

Congrats!! That’s all for now, you compiled and ran your first program

Don’t worry about trying to understand the syntax yet. Ensure you can run this code successfully on your computer.

in c++ your programs are saved with .cpp extension.

Compilers

A C++ compiler is used to compile C++ source code. the compiler checks your code for errors (if you are not following c++ rules) and translates your code to an Object file. C++ is a high-level language, the compiler’s job is to translate it to a machine language. Object files are saved with .obj or .o extension.

The Linker

The linker combines all the object files into a single executable program.

Standard Library

C++ standard library contains reusable codes that you can add to your source code. no need to reinvent the wheel.

e.g Iostream Library contains functions that help you get input from a keyboard and also print to screen.

Accomplishments

you set up your IDE, compiled and ran your first c++ program.
learned a little history and other important things to know about the language.

download code on GitHub

Exercises 1.0

Can you print your name on the console?

Try the exercise and share your results in the comment section

print your name to the console
print your name on the console

See you on day 2 🙂