1. Nmap and Nmap History
  2. Working In a High School As A Computer Instructor
  3. Penetration Testing Jobs in worldwide – A Valuable Online Resource
  4. Types of computer software
  5. Cross-site scripting (XSS) attack
  6. Five Best Cyber Security and Ethical Hacking Private Degrees in Sri Lanka
  7. Google’s open-source tsunami vulnerability scanner
  8. What is Google? (Tutorial)
  9. What is a SQL Injection Attack?
  10. Is WordPress Easy?
  11. How to find a perfect domain name for your website (10+ Tips and Tricks Tutorial)
  12. 6 new vulnerabilities with D-Link home routers allow hackers to launch remote attacks
  13. What is the YouTube and YouTube AdSense?
  14. C++ Lesson 6 – Storage of information through user interactions and VARIABLES
  15. How to get full root Access by Termux without Root?
  16. Trojan horse’s Story | who is this Trojan horse
  17. Don’t use these wallpapers in your mobile phone – System Crash wallpaper issue
  18. Burp Suite pro [Professional 2020.4.1]
  19. Website SEO checker tool
  20. What is DNS? (Domain Name System)
  21. C++ Lesson 5 – Get ready for the first program – Part 2
  22. Whatsapp Secrets Code List
  23. Python Lesson 1 – Python and Computer Programming
  24. C++ Lesson 4 – Get ready for the first program
  25. C++ Lesson 3 – Setting the background PROGRAMMING for LINUX.
  26. What is an Email? (Learn about Email)
  27. GoDaddy reveals a data breach, exposing the credentials of the web hosting account
  28. C++ Lesson 2: Setting the PROGRAMMING Background for WINDOWS
  29. C++ full tutorial | How to start C++ | Part 001
  30. What is the IP Address? – Full Tutorial
  31. How to install Kali Linux in windows Computer using virtualBox – 001
  32. Online YouTube Backlink Generator Tool
  33. How to use ShellPhish in mobile phone – Advance Phishing tool
  34. Remote Command Execution (R.C.E) vulnerability
  35. Mobile phone Ethical Hacking & Penetration Testing platform (Termux)
  36. Nmap network scanning (Basic Tutorial for Beginers) – 002
  37. Nmap Port Scanning tool (Basic Tutorial for Beginers) – 001
  38. Penetration Testing and Ethical Hacking Linux Distribute – Kali Linux
  1. Nmap and Nmap History
  2. Working In a High School As A Computer Instructor
  3. Penetration Testing Jobs in worldwide – A Valuable Online Resource
  4. Types of computer software
  5. Cross-site scripting (XSS) attack
  6. Five Best Cyber Security and Ethical Hacking Private Degrees in Sri Lanka
  7. Google’s open-source tsunami vulnerability scanner
  8. What is Google? (Tutorial)
  9. What is a SQL Injection Attack?
  10. Is WordPress Easy?
  11. How to find a perfect domain name for your website (10+ Tips and Tricks Tutorial)
  12. 6 new vulnerabilities with D-Link home routers allow hackers to launch remote attacks
  13. What is the YouTube and YouTube AdSense?
  14. C++ Lesson 6 – Storage of information through user interactions and VARIABLES
  15. How to get full root Access by Termux without Root?
  16. Trojan horse’s Story | who is this Trojan horse
  17. Don’t use these wallpapers in your mobile phone – System Crash wallpaper issue
  18. Burp Suite pro [Professional 2020.4.1]
  19. Website SEO checker tool
  20. What is DNS? (Domain Name System)
  21. C++ Lesson 5 – Get ready for the first program – Part 2
  22. Whatsapp Secrets Code List
  23. Python Lesson 1 – Python and Computer Programming
  24. C++ Lesson 4 – Get ready for the first program
  25. C++ Lesson 3 – Setting the background PROGRAMMING for LINUX.
  26. What is an Email? (Learn about Email)
  27. GoDaddy reveals a data breach, exposing the credentials of the web hosting account
  28. C++ Lesson 2: Setting the PROGRAMMING Background for WINDOWS
  29. C++ full tutorial | How to start C++ | Part 001
  30. What is the IP Address? – Full Tutorial
  31. How to install Kali Linux in windows Computer using virtualBox – 001
  32. Online YouTube Backlink Generator Tool
  33. How to use ShellPhish in mobile phone – Advance Phishing tool
  34. Remote Command Execution (R.C.E) vulnerability
  35. Mobile phone Ethical Hacking & Penetration Testing platform (Termux)
  36. Nmap network scanning (Basic Tutorial for Beginers) – 002
  37. Nmap Port Scanning tool (Basic Tutorial for Beginers) – 001
  38. Penetration Testing and Ethical Hacking Linux Distribute – Kali Linux
C++ Lesson 6 – Storage of information through user interactions and VARIABLES

Check all C++ tutorials from here – C++ Tut pack

Well, we learned in previous lessons how to view the information we offer through the program and how to add comments to our program. But how can we do it if we want some information outside the program?

This is what we will learn today. When we retrieve information from outside the program, we should be able to store it in the program. So we use variables to store this information. Here we use different types of variables to store different types of information. To store this information we must first introduce the Ganga variable into the compiler. Let’s say declare a variable. So there is a method used to declare this variable. First we have to give the data type of the variable we are using and then the name we give to that variable.

Some of the most basic types of data we use are char, int and double. In this type of character data we can only store one character, and in this type of int data we can only store integers and in this double type of data we can store numbers with decimal places. So for all data types, this name is the keyword we use when declaring a variable.

Declaring variables in C++

As I said before using a variable, we must first declare that variable. So the rule when declaring a variable is first the data type and then the variable name.

If we take a small example:

int whole_number;
char letter;
double number_with_decimals;

And we can declare this way if we have multiple variables of the same type.

ALSO READ  C++ Lesson 2: Setting the PROGRAMMING Background for WINDOWS

int a, b, c, d;

Variables are used

Well now we know how to declare a variable to the compiler. Now let’s see how to use this declared variable. So we need results to store this variable in our variable. It’s like the opposite side of Cout. Well, let’s see how we can use cin to store data for our variable.

#include <iostream>
using namespace std;
int main ()
{
    int thisisanumber;
    cout << “Please enter a number: “;
    cin >> thisisanumber;
    cout << “You entered: ” << thisisanumber << “\n”;
}

Let’s take the line and see what happens. I won’t tell you about the original line 3, because you already know it. We will see it soon.

int thisisanumber;

This is to declare this variable number in the int data type.

Qin >> thisisanumber;

cin >> This function stores the value of the user type in this variable number.

Earlier I told you in the program that if you open your program in cmd, it will exit quickly. But you can add this line in this program and the problem persists. This is because the “cin.get ()” line indicates that the program is waiting for the user to press the key. But in this program you have to memorize a value for the variable and type the value and press the Enter key where the signal pressed key takes this line “cin.get ()” so that the program exits quickly. We do this by adding another line to the program.

cin.ignore();
    cin.get()
}

This is done by ignoring the first key pressed and waiting for another key pressed.

ALSO READ  C++ Lesson 3 - Setting the background PROGRAMMING for LINUX.

Well, then you need to run this program. You can also use the other data types instead of the int data type where you only need to change the data type so you don’t have to change anything else in the code. We will get there in the next lesson.

Tags: , , , , , , , , , , , , , , , , , , ,
Thiwanga Sandaruwan is a professional blog writer. SecDevil.com is the main website of he managed. If you have any problem feel free and contact him.

Related Article

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge