2:05 AM
OVERVIEW OF C++
Just like Python, C++ is a type of programming language. But, unlike Python in which we have to install Anaconda or Miniconda, in C++ we do not have to install the software as they can be used online.
Here is the software link. https://repl.it/
Just browse it, log in , search for the C++ program and you are ready to use it!!!
For this lectures, we referred to this link, https://padlet.com/azni_astro/KOS1110CPP for the notes.
First, let's explore the basic elements of this programming language. There are:
- Simple C++ program
- Statement execution
- Input/Output operations
- Data types
- Arithmetic expressions
- Additional operators
- Selection statement
- Repetition statement
- Displaying Table.
1) Simple C++ Program
Enter the command, click run and you will get the output.
This includes executing the statement and stating the input also it's output.
2) Data types
- floating point numbers - numbers with fraction or decimals
- integers- exact number without decimal
- characters- single character, enclosed in single quotes
- string- group of characters, enclosed in double quotes.
3) Arithmetic expressions
- the operations are done step by step, the expression can also be used foe division, percentage and rounding off.
4) Additional operators
by using this program, we just insert the formula and introduce the unknowns and finally we will find the answer we desired for.
5) Selection statement
- we use the if/ else statement in comparing the situation. If we enter our data, the program will show our status in condition that the the status are derived and introduced first.
6) Repetition statement
-3 types of loop statement:
- ‘while’ statement
- ‘for ’ statement
- ‘do-while’ statement
- 2 types of loop:
- sentinal loop = loop that gives a specific value marking the end point (eg: determining wavelength)
- counting loop= representing the number of loops( eg: determining number of car exceeding the speed limit.)
7)Displaying table.
- Need to include library <iomanip>
- https://repl.it/H526/2 (can refer to the link for the example)
- this is the example for an alligned table, https://repl.it/H56f/
*Credit to Dr. Azni for the notes and the slides.
0 comments