Reading String From Input in C++

In this article, we will discuss different ways to read strings from input in C++. The cin object and getline function can be used to read strings. Using the cin to read string input In this example, we will use cin object to read strings. The cin is an istream object. Output Note that there … Read more

Update Software in Ubuntu

Sometimes we may need to update already installed specific software packages (Firefox, Nginx, etc) in Ubuntu. In this article, we will discuss a way to update a software package using the terminal. If we run sudo apt upgrade command it will update all the packages. We can update a specific software package by following the … Read more

Virtual Destructors in CPP

In this article, we will discuss virtual destructors in CPP. Destructor is part of Resource Acquisition Is Initialization(RAII) programming idiom. The basic idea of RAII is constructor will acquire(allocate) resources and the destructor will release resources for a class. The most common example of a destructor is when the constructor uses new, and the destructor … Read more

Size of C++ classes

In this article, we will discuss the size of C++ classes. We will look into an empty class, a class with member function, a class with virtual functions, and a class with data members. We will be using a 64-bit machine to compile the test code. For a 64-bit machine, the pointer size is 8 … Read more

Internet Speed Test From Terminal

Sometimes we need to test internet speed and we shall use websites like speedtest.net,fast.com etc but in this article, we will discuss a way to check internet speed from the terminal. We can use speedtest.net CLI(Command-line interface) tool to check the internet speed. Install speedtest CLI on Ubuntu/Debian Firstly, install curl using the below command. … Read more

How to install Redis on WSL

In this article, we will discuss how to install redis on WSL. Redis is an in-memory key-value data structure store, used as a memory key-value database, cache, and message broker. Officially, the redis is not supported on Windows. However, we can run it on WSL (Windows Subsystem for Linux). We will be using Windows 10 … Read more

Shortest C++ Program

shortest c++ program

Have you ever thought about the shortest C++ program? In this article, we’ll look into the shortest C++ program. C++ is a compiled language. Firstly, the compiler processes the source code files and produces object files. The linker will combine these object files to yield an executable program. Let’s look into the smallest C++ program … Read more

How to convert std string to int in C++

std string to int in c++

In this article, we will discuss various methods to convert std::string to int in C++. 1.Convert string to int using atoi function The atoi function parses C-style string (null-terminated) content as an integer. Syntax of atoi Defined in header <cstdlib> (stdlib.h) Arguments str – C- style null-terminated string Returns On success, returns the converted number … Read more

Maximum value of integers in Python

In this article, we discuss the maximum value of integers in python. We will consider python 2 and python 3 versions. Python 2 In python 2, integers are internally handled using int and long data types. If the number value is beyond int’s maximum value of int it automatically switches to a long data type. … Read more