Postingan

Informatics - BMI Calculator (Week 20)

Gambar
 Do you ever wonder if you're underweight or overweight, but you don't know how to calculate your BMI ( Body Mass Index). Body Mass Index (BMI) is a simple calculation used to determine if a person has a healthy body weight based on their height and weight. A BMI Calculator program is a simple program that calculates a person's Body Mass Index (BMI) based on their weight and height. It categorizes the BMI result into different health ranges such as Underweight, Normal weight, Overweight, or Obese based on standard BMI classifications.  Here's the code of BMI Calculator program! //program BMICalculator.cpp #include <iostream> #include <iomanip> #include <cmath> using namespace std; float weight, height_cm, height_m, bmi; void calculateBMI (){     height_m = height_cm / 100.0;     bmi = weight / (height_m * height_m);     cout << fixed << setprecision(1);     cout << "Your BMI score is " << bm...

Informatics - Addition & Substraction (Week 19)

Gambar
Hola! Como estas? In this blog I will show you a really simple code about addition and subtraction between two numbers. It's really simple and I'm sure every new programmer can do this! Here's the code! // Program: AdditionSubtraction.cpp #include <iostream> using namespace std; int val1, val2; void add() {     cout << "Enter first number: ";     cin >> val1;     cout << "Enter second number: ";     cin >> val2;     int result = val1 + val2;     cout << val1 << " plus " << val2 << " is: " << result << endl; } void subs() {     cout << "Enter first number: ";     cin >> val1;     cout << "Enter second number: ";     cin >> val2;     int result = val1 - val2;     cout << val1 << " minus " << val2 << " is: " << result << endl; } int main() {  ...

Informatics - Triangles (week 18)

 Hi everyone! In this week I just want to show you some codes of how to make a standing up and also upside-down triangle. There will be some types of triangles here so stay tuned! 1. Right Triangle #include <iostream> int main (){     for (int i = 1; i <= 5; i++){         for (int j = 1; j <= i; j++){             std :: cout << "*";         }         std :: cout << std :: endl;     }     return 0; } This program prints a right-angled triangle pattern using asterisks (*). It uses a nested for loop, where the outer loop controls the number of rows (from 1 to 5), and the inner loop controls how many * are printed in each row. In each iteration of the outer loop, the inner loop runs from 1 up to the current row number (i), printing that many stars. After the inner loop finishes, a newline (endl) is printed to move to the next row. As a result, ...

Informatics - Currency Change Calc Version 2 (Week 17)

Gambar
 Hello! How was your holiday? Have you gone to the country that you want? I'm back with Currency Change Calc Version 2!  Don't worry! I only add some addition here but not changing the main code. Here, I only add the do-while loop. A do-while loop is a type of loop that always runs at least once, regardless of the condition. It first executes the code inside the loop, then checks if the condition is true. If it is, the loop repeats; if not, it stops. This is useful in situations where you need to ensure that something happens at least once, such as prompting a user for input until they enter a valid value. Here's the code after some adjustment! //program lengthConverter.cpp #include <iostream> #include <iomanip> #include <limits> using namespace std; double rupiah, won; void rupiah2won(){     do {     cout << "Enter money in rupiah:";     cin >> rupiah;     if (rupiah < 0) {       ...

Informatics - Currency Change Calc Version 1 (Week 16)

Gambar
 OMG It's holiday time! Happy holiday everyone!  Anyway, are you planning to go somewhere on this holiday? Is there any of you who wants to go to outside of the country but still confused about the budget there because you don't know how to calculate currency change? No need to worry! I'm here to help you. So the base of the code will be the same as the length converter which we're going to use functions and switch statement. In this program I will convert Rupiahs to Won and otherwise. So, the first thing you need to find is the currency change. You can find it on google! So here 1 Rupiah is equal to 0.089 Won and 1 Won is equal to 11.26 Rupiahs.  Here's the code of the program! //program CurrencyChangeCalc.cpp #include <iostream> using namespace std; double rupiah, won; void rupiah2won(){     cout << "Enter money in rupiah:";     cin >> rupiah;     won = rupiah*0.089;     cout << rupiah << " rupiah is ...

Informatics - Length Converter Version 2 (Week 15)

Hmm last week we made a length converter from feet to meters and otherwise. Now, I'll show you how to convert centimeters to inch. But here, there will be some addition rather just to change the code. The addition is we will make a do-while loop. In this program, the do-while loop is used to keep asking for input and performing the conversion. If the user enters a negative number, it prints "error" and stops with a break. Here's the code of the centimeters to inch length converter: //program ConverCm2Inch.cpp #include <iostream> #include <iomanip> #include <limits> using namespace std; double cm, inch; void cm2inch(){     do{ cout << "Enter value in cm: "; cin >> cm; if (cm < 0){     cout << "ERROR";     break; } inch = cm * 2.5; cout << cm << "is equal to: " << inch << "inch"; }while (cm < 0); } void inch2cm (){     do { cout << "Enter value in inch: ...

Informatics - Length Converter Version 1 (Week 14)

Gambar
 Hi! Are you working as an architect? Or are you a carpenter? Well, you're on the right page. Have you ever felt the feelings when you need to convert length, but you are too busy to convert it by yourself? Here, I'll show you a code to convert a length from feet to meters and otherwise. You only need an online compiler and a code! Here we'll use functions and switch-case statement to make the length converter. Functions are used in the program to keep the code organized, reusable, and easy to maintain. Instead of writing the conversion logic multiple times, functions allow the program to call them whenever needed, making updates or fixes simpler. The switch-case statement is used because it efficiently handles multiple choices, making the code faster and easier to read compared to multiple if-else statements. Each case corresponds to a specific action, ensuring the correct function is executed based on user input. Here's the code of the program: //program lengthConvert...

Informatics - Making Minimarket Discount Program in C++ Version 2 (week 13)

Gambar
Are you ready for version two? Don't worry it's only needed a little addition and I'm sure you can do it by yourself! Your boss will be proud of you and maybe you'll get bonus? So, without any further do, let's start!  So, the first version is only for counting the discount and the total price. But what if your minimarket wants to give a bonus item for a specific threshold? So, in second version I will show you how to add the bonus item for specific threshold.  We start from the first code that we have made: //program minimarket_discount_v1.cpp #include <iostream> #include <iomanip> using namespace std; int main (){ double totalPurchase, discount = 0.0, finalPrice; cout << "Please enter the amount of purchase (in Rupiah): Rp"; cin >> totalPurchase; if (totalPurchase >= 1000000){     discount = 0.2; } else if (totalPurchase >= 500000){     discount = 0.1; } else if (totalPurchase >= 200000){     discount = 0.05; } e...

Informatics - Making Minimarket Discount Program in C++ version 1 (Week 12)

Gambar
 Happy new year all! 💥 I know it's pretty late but anyways I'm writing my first blog on this year. In this blog I'm going to share my assignment of making a minimarket discount program in C++. There will be two version of this program and here, I'm going to show you the first version. The purpose of this program is to check the total purchase amount against the specified thresholds to determine the applicable discount rate. It will also calculate the final price by subtracting the discount for the total purchase. As a reference to make this program, I was given a similar program.  // program GradeConverter.cpp #include <iostream> #include <iomanip> using namespace std; int main (){ int score; string grade; cout << "Please input numerical score (1-100):"; cin >> score; if(score <= 100){ grade = "A+"; } else if (score >= 80 ){ grade = "A"; } else if (score >= 70 ){ grade = "B"; } else if (scor...

Informatics - Making a Main C++ Program to Run all the Calculator Program (week 11)

Gambar
Hi everyone! So, in this blog I want to share to you about how I make a main C++ program to run all the financial calculator program. Financial calculator program is program that used to calculate financial problem based on users need. The goal of this program is user can calculate their financial problem by choosing one of the programs available.  There will be interest rate, compound interest rate, cash flow, and moving average calculator inside of this financial calculator. Notes: - Interest rate is the percentage charged by a lender to a borrower for the use of money, or the percentage earned by an investor on their money over time. It is expressed as an annual percentage of the principal amount. - Compound interest rate is the rate at which interest is calculated not only on the initial principal amount but also on any accumulated interest from previous periods. This results in the interest "compounding" over time, which can grow the total amount much faster than simple ...

Informatics - Run the Cash Flow Calculator Program (week 10)

Gambar
Hi all! Here I am again making another post for you. As I promised last week on my previous post, I will show you how to run the Cash Flow Calculator program on windows. Are you excited? Let's run the program together! I will show you how to run it step by step.  First step: The first step is open the folder you made for this program on your file explorer. Here, I put my folder on the documents.  Here, I named my file as Cashflow Calculator.  Second step: Right click then choose the "open in terminal" option.  After you click the "open in terminal" option you will straight go to the Command Prompt.  Third step: Type "g++ -c ./*.cpp" to compile the programs. If it succeeds you will go straight to the next step, then type "ls" to list the files in the folder. But if your program can't be compiled there will be "error" word on the command prompt, and it means that there's something wrong with your program.  As you can see there...

Informatics - Copying CPP Files Cash Flow Calculator (week 9)

Gambar
Hello everyone! Meet me again on my second blogpost after midterm break. As I stated in previous blogpost, here I will show you two C++ files as the continuation of the Cash Flow Calculator program. A C++ file (commonly referred to as a .cpp file) is a source code file used to write programs in the C++ programming language. This code will be longer than the previous one. So, without further do, here's the codes!.  The first file of the C++ file is CashFlowCalculator.cpp. This code is the longest one of the C++ code. Here's the code: This code defines a CashFlowCalculator class that calculates the present value of future cash flows. Present value is the current worth of a future amount of money or stream of cash flows, discounted at a given rate of interest. It allows you to: - Set a discount rate (e.g., interest rate). - Add cash payments with their corresponding time periods. - Calculate the total present value, which is the current worth of all future cash payments. The seco...

Informatics - Copy Header Files Code CashFlowCalculator (week 8)

Gambar
Hello everyone! How have you been? Waiting for my blogpost? haha just kidding. I'm back with my informatics program again. This time I am copying a code from my teacher. This code is about Cash Flow Calculator. Cash flow is the net balance of cash moving in and out of a business over a period of time. A cash flow calculator is a financial tool designed to help individuals, businesses, or investors estimate, analyze, and manage their cash flow over a specific period. It calculates the net amount of cash inflows and outflows, providing insight into financial health, profitability, or liquidity. Here, I'll show you the code that I copied.  The first code is the header file of the program which is CashFlowCalculator.h. Header files contain a set of predefined standard library functions. The .h is the extension of the header files in c++ and we request to use a header file in our program by including it with the c++ preprocessing directive “#include”. Line 1:  Allows the progr...

Informatics - Decimal Formatting Program (week 7)

Gambar
Hi everyone, here we go again with informatics c++ program. This block is actually still related with the previous block. So, I recommend you read my previous  blog  first.  As you can see there, the result of the calculation is quite confusing right? There's no such proper dots or coma to separate the numbers. Here, with this code program in c++, we can format the decimal and also make the numbers readable and tidier. I use code blocks to compile and run the program. Attach is the syntax of the program: Line 1: provides access to the std::locale class and related functionality, which allows us to handle locale-specific settings such as number formatting. Line 2: allows the use of standard input/output streams, including std::cout for output. Line 3: provides functions for manipulating input and output streams, such as setting precision and formatting. Line 5: defines a new class comma_numpunct, which inherits from std::numpunct<char>. std::numpunct is a c...

Informatics - Compiling Program - Compile and Run the Program Using Command Prompt (week 6)

Gambar
Hello everyone! Finally, after a lot of drama installing the compiler, I can compile and run my program. I compile and run my program by using Command Prompt. In this blog I would like to share to you about how to compile and run the program by using Command Prompt. A Command Prompt is basically a Command Line Interface. It is an application in which the user enters commands, and the operations are executed accordingly. The Command Prompt is an integral part of the Windows Operating System.  As I stated in the previous blog, the program is in the c++ programming language, and the result is to calculate simple rate interest and compound rate interest.  So here are the steps to compile and run the program in Command Prompt.  Step 1:  Open the file storage and where you save the file. Here, I save my file on the documents. Then double click the folder.  Step 2:  Choose the zip file and then right click the file and press the "Open in Terminal" option...

Informatics - Compiling Program - Downloading the MinGW by Following a Website Tutorial (week 5)

Gambar
Hi y'all, here we go again to the week 5. In this blog I would like share of how to install MinGW in windows 11. If you read my previous blog, there was something wrong when I was installing the compiler. Here, I'm trying to install MinGW by following a  website  tutorial.  The first step  we need to do is going to the  MinGW  website then click  download .  Second step.  After finish download, click  open file  then click  install.   Third step.  After finishing installing, click  continue  then MinGW installation manager will appear. Fourth step.  In the installation manager,  right-click  on  each  option and then  click Mark for Installation . In the Installation options, click  Apply changes . Then select  Apply . All files will start downloading. This process will take 5-6 minutes. When  finished , click  Close . How to Change Environment Variables for ...

Informatics - Compiling C++ Program - Try to Download the MinGW by Watching Youtube Tutorial (week 4)

Gambar
Hi everyone, in this blog I will share my experience of how compiling c++ program in windows. This is my informatics school project.  The result of the program is I can calculate simple rate interest and compound rate interest. In the first week I'm trying to compile it in the visual studio code, but unfortunately my step is wrong, so the program is error. it stated that there is no such file in my directory. Which means my computer have no idea about the program.  In windows, to compile the c++ program we need to have MinGW as a compiler and insert it to our computer environment. And at that time, I didn't have it. So, I decided to download the MinGW first. To download it I open the YouTube and search of how installing the MinGW compiler in windows.  I was following this  YouTube  tutorial to install MinGW to build C++ code So, from this video the first step you need to do is download the latest installer from the  MSYS2  page. After successfully...

Informatics - Extracting Locked Picture from Instagram (week 3)

Gambar
Hey everyone! Meet me again with another blogpost. This post is going to be so fun because I'm sure y'all have ever considered this. Have you ever wondering of how to download a picture from Instagram? I'm sure y'all have tried to use like some apps to download the picture by copying the link address of the picture. And sometimes you even cannot save the pictures because the account is private right? Well, you can actually save those pictures without the apps, and it's definitely will work. So, if you curious of how to do it, just read this blog and follow the step, good luck!  Step 1:  Find an Instagram post that you want to extract. Here I'm taking a beautiful picture of a moon from Nasa Instagram account.  Step 2:  Right click the picture and choose the inspect option. Then you will straight go to the inspection window.  Step 3:  Read carefully the list of the class. You will see the highlighted line followed by 3 dots. When you move your cursor to that,...