Second Class, Second Blog (Blog of the second class 12/01/17) and Hello World.cpp

helloworld

So in this class that i had on last Thursday we started how to enter the wonderful world of coding and writing in C++. To make a program using this techique in C++ you need 2 things:

  1. A hackable Text Editor for the 21st Century
  2. A Terminal

The Text Editor is the tool where you can write and save YOUR PROGRAM in C++ with the extention in .cpp. The Terminal is the tool which shows the user to manage and see all the input and output data (101010101) compiling the information given from the text editor (C++).

In my last post I talked about the terminal that i am using called ubuntu in windows 10 where i installed with the help of my teacher who gave me a link in First Class, First Blog (Blog of the first class 9/01/17) and in this second class the teacher recommended to me and the class to use the text editor that was missing to getting started with coding our first code call the famous Hello World in C++.

The Text Editor I will be using for the class is called Atom where you can download it to any kind of operative system like windows or mac at this link https://atom.io/ where is the official website and where io stands for input and output of data:

atom2

atom

After installing atom i created a new C++ file and when i saved in a C++ file with the extention .cpp, the code turn out in colors like in this picture:

atom-hello

After that i open my terminal ubuntu but i wrote at first the command for compile (compile is the action of transforming any kind of languague to machine languague that only is 1 or 0 1010101010101110)  and the software needed it to install a package of fuctions and configurations. So after installing the package i wrote the command again from the new c++ file with the command g++ hello.cpp and the command line of ubuntu or terminal told me that it had a fatal error of no finding hello.cpp showing in the next photograph:

firsr-error So i had my first error where i fixed it with the help of my teacher using these commands to tell the terminal to search in the place where i had the file (hello.cpp) in downloads.

  1. The command was cd =Change of directory
  2. Next add a command called mnt=It stands for mounting and this helps the terminal to go search in the local disk drive C
  3. After add the source of the hello.cpp from local disk drive C (My User called fabco)
  4. All the instruction transforms to: cd /mnt/c/Users/fabco/Downloads

And by doing a video tutorial that i made reafirming that part at this link: First Tutorial Hello World 12/01/17 AND THIS OTHER LINK #TC1017 Second Class Hello World 12/01/17 !!

Finally with the command ./a. out tells the terminal to run de C++ file

hello-world

This code will be here and in Github:

Link in Github: https://github.com/fabcor95/TC1017

if you do not want the hello.cpp there is it in here with comments. The comments are very useful to detect errors and create new things:

#include <iostream> //Library to call all the

//fuctions of inputs and outputs of data in languague
//C++

using namespace std; //In C++ we need a command

// that everytime goes with the instructions of input and outputs
//of data that is call std but with this command helps writing
//these std out of the main because the machine factorizes them

int main () //Begin of the program
{

cout<<"Hello World"<<endl; //command of out data in form of text

}// End of the program

Anuncio publicitario

15 comentarios en “Second Class, Second Blog (Blog of the second class 12/01/17) and Hello World.cpp

Deja una respuesta

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Salir /  Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Salir /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Salir /  Cambiar )

Conectando a %s