Mastery Topics 6 – Calling a function

--Originally published at The Talking Chalk

mas2aAs seen in the example form Mastery Topics 2. You should only write the function outside the main fucntion and finally, in the main fucntion, write the name of the function while stablishing what are the parameters for it (making sure the type of each parameter is the adequate for the function. remember that int and doubles can be easily converted, but char cannot become an int or a double and viceversa).


Mastery Topics 4 – Output

--Originally published at The Talking Chalk

As easy as it may see, after importing the library and use namespace std, to give an output you only have to write an int main() and follow between the braquets a cout (comes out), two arrows towards the left (<<), the text within quoting marks and following yet another two arrows with endl or \n, both are correct as long as you end with a semicolon.


Mastery Topics 3 – Basic types and their use.

--Originally published at The Talking Chalk

A type determines what the variable is and what can contain.

Baisc types are int, double and char.

Char is for variables with text, however, you have to denotate the number of characters for it, as if you print a Char=”Hola”, it will only print the first letter.

Int is for integer numbers and double for float numbers. If you declare an int variable’s value as a float number (ex: int x=2.4), decimals will be chopped out; similarly, when you give a double variable’s value an integer number, a decimal space is added to it (ex: double x=1, will be interpreted as 1.0)

 


Mastery Topics 2 – C++ good style coding covnentions

--Originally published at The Talking Chalk

To have a proper coding style you have to optimize the space of the text of the code, use comments, remove innecesary codes (or make them shorter).

A simple example is the code I used for the WSQ05, which, looking at it again, sucks on space optimization.

mas2

This way is how it should be coded

mas2a

Use of comments to describe what thing does that part of the code does, remove spaces that are not necessary, yet leaving those that may distinguish which part of the code are similar to others. (inputs and outputs, functions)


Mastery Topics 1- Comments

--Originally published at The Talking Chalk

A comment is a piece of text in a cod that is meant to be readed for humans, not programs. Their main use is to facilitate the programmer to understand the code.

#include <iostream>
using namespace std;
int main()
{
cout<<“Hi”<<endl;//This is a comment
cout<<“Hellow world”<<endl;  /*which can be used to say that
this will print out
“Hello world”*/
}mas1


Mastery Topics

--Originally published at Adal´s Blog

Common #TC101 Topics



Los temas que debemos de abarcar durante este curso son estos, cada ves que se abarque un tema nuevo se subrayara, para asi saber que temas ya se han abarcado

  1. Use of comments
  2. C++ Good Style coding conventions
  3. Basic types and their use
  4. Basic output (print)
  5. Basic user input (text based)
  6. Calling functions
  7. Creating functions
  8. Importing and using libraries
  9. Creating and using your own libraries (program with multiple files)
  10. Use of the conditional “if”
  11. Use of “else” with a conditional if
  12. Nesting of conditional statements (ifs inside ifs)
  13. Use of loops with “while” and “do while”
  14. Use of loops with “for”
  15. Nested loops
  16. Use of recursion for repetitive algorithms
  17. When to use what type of repetition in a program
  18. Creation and use of Arrays/Vectors in C++
  19. Creation and use of strings
  20. Validated user input (ensure correct/expected data entry)
  21. Reading and writing of text files
  22. Matrixes and Vectors
  23. Data analysis with tools (to be determined which tool, most likely SciLab)
  24. Visualization of data with tools
Actualizado al 2/Mayo/2017