Factorial calculation with C++ do-while loop
Friday, June 28, 2024 in C++
Categories:
less than a minute
In this example, we show how to calculate factorial using the do while loop. #include <iostream> using namespace std; int calculateFactorial(int number) { int result = 1; for (int i = 1; i <= number; i++) { result *= i; } return result; } …
C++ Example calculating the factorial of the entered number
Friday, June 28, 2024 in C++
Categories:
less than a minute
In this example, we show how to calculate the factorial of the entered number with the help of a function. #include <iostream> using namespace std; int factorial(int num) { int result = 1; for (int i = 2; i <= num; i++) { result *= i; } …
C++ adding int and float variables
Friday, June 28, 2024 in C++
Categories:
less than a minute
In this example, we show how to find the sum of 2 variables of type int and float. #include <iostream> int main() { int firstNumber = 11; float secondNumber = 12.8; float sum = firstNumber + secondNumber; std::cout << "Sum: " …
C++ Code example to convert Fahrenheit temperature to Celsius
Friday, June 28, 2024 in C++
Categories:
less than a minute
In this example, the entered Fahrenheit temperature value is converted to Celsius value with the help of a function. #include <iostream> #include <iomanip> #include <limits> float temperatureConversion(const float …
Printing int, float and string values with printf in C++
Friday, June 28, 2024 in C++
Categories:
less than a minute
This code defines a main function where the int and float variables are constants and the text variable is not. Prints the values number, realNumber, and text and then returns 0. #include <iostream> #include <cstdio> #include …
C++ 2 string variable concatenation
Thursday, June 27, 2024 in C++
Categories:
less than a minute
In this article, we show an example of combining 2 string variables. #include <iostream> #include <string> int main() { std::string firstString = "prs"; std::string secondString = "def"; std::string result; result = …
Combining 2 variables of type char in C++
Thursday, June 27, 2024 in C++
Categories:
less than a minute
In this example, you can see how to combine 2 char variables with a length of 50 characters using the strcat method. #include <iostream> #include <cstring> using namespace std; int main() { constexpr size_t bufferSize = 50; char …
Finding whether a number is positive or negative with C++
Thursday, June 27, 2024 in C++
Categories:
less than a minute
In this example, we check whether the number entered from the keyboard is positive, negative or zero by using if-else if. #include <iostream> using namespace std; int main() { int number; cout << "Please enter a number: "; cin …
C++ Nested if statement
Saturday, June 22, 2024 in C++
Categories:
less than a minute
In this article, we share an example showing C++ nested if statement. #include <iostream> using namespace std; int main() { /* nested if else statement */ int a; cout << "Enter a positive integer number: "; cin >> a; if (a …
C++ Cascade if else statement
Saturday, June 22, 2024 in C++
Categories:
less than a minute
You can see the usage of cascade if-else statement example below. #include <iostream> using namespace std; int main() { /* cascade if else statement */ int a; cout << "Enter a positive integer number: "; cin >> a; if (a < …
How to restart TouchBar on MacOS?
Saturday, June 22, 2024 in macOS & iOS
Categories:
less than a minute
The touchbar on Macbook Pro models provides very good ease of use. You may notice that some touch bars work differently than they should or are not responsive at all. We have prepared a recommendation to solve this problem. You should try these …
C++ if else statement
Saturday, June 22, 2024 in C++
Categories:
less than a minute
In this article, you can examine the use of C++ if else statement. #include <iostream> using namespace std; int main() { /* if else statement */ int a; cout << "Enter a positive integer number: "; cin >> a; if (a < 20) { …
How to view source code in Safari?
Thursday, June 20, 2024 in macOS & iOS
Categories:
less than a minute
Viewing the source code of a page lets web designers and developers achieve their preferred layout. It helps them debug websites quickly by just viewing the source of web pages. Advanced Mac users can benefit greatly from viewing the page sources on …
10 Essential Topics to Learn Android Programming
Thursday, April 11, 2024 in Android
Categories:
2 minute read
We asked the Gemini artificial intelligence application, which is available with Android Studio Jellyfish, about what steps need to be achieved to learn Android Programming. We wanted to share the answers we received with you in this article. Set Up …
How to force quit software on MacOS
Sunday, February 04, 2024 in macOS & iOS
Categories:
less than a minute
If a program freezes, crashes, or stops responding on your macOS operating system, you can follow the steps below. Force stop with key combination Press Option(Alt) + Command+ESC (Escape) on your keyboard or select “force quit” from the …
How to change targets with systemd on Linux
Wednesday, January 24, 2024 in Linux
Categories:
4 minute read
When you start the Linux operating system, the system that controls the startup processes that occur respectively is called “init system”. Some Linux distributions use SysV launcher, and some distributions use systemd. If you’re …
Variable naming rules in Kotlin
Tuesday, January 23, 2024 in Kotlin
Categories:
2 minute read
As you know, every variable must have a unique name. Although it may seem problem-free at first, as your software expands, your codes may become difficult to understand. Most of the software developers’ time is spent reading the code written by …
apropos command in Linux
Tuesday, January 23, 2024 in Linux
Categories:
5 minute read
You may sometimes have problems remembering ready-made commands on the Linux command line. You may not remember which command is related to what. In such a case, you can search the definitions on the command manual pages with the …
Comment Lines in Kotlin Programming
Sunday, January 21, 2024 in Kotlin
Categories:
3 minute read
A computer program consists of various pieces of code coming together and working in harmony. Each block of code does what is expected of it. As time goes on, the program developers who write these codes begin to forget and get confused about which …
Kotlin value assignment and type inference
Saturday, January 20, 2024 in Kotlin
Categories:
4 minute read
In this article, we will explain some of the finer points you need to know about defining variables in the Kotlin programming language. We have prepared this article in addition to the rules we explained in our previous two articles ("Kotlin …