Daily Archives: November 2, 2020

VB.NET || How To Get First/Last Day Of the Week And The First/Last Day Of The Month

The following is a module with functions which demonstrates how to get the first and last day of the week, as well as how to get the first and last day of the month using VB.NET.


1. First & Last Day Of Week

The example below demonstrates the use of ‘Utils.DateVal.GetWeekStartAndEnd‘ to get the first and last day of the week.

By default, the start of the week is set on Monday. This can be changed by setting the second parameter to any valid property contained in the Microsoft.VisualBasic.FirstDayOfWeek enum.


2. First & Last Day Of Month

The example below demonstrates the use of ‘Utils.DateVal.GetMonthStartAndEnd‘ to get the first and last day of the week.


3. Utils Namespace

The following is the Utils Namespace. Include this in your project to start using!


4. More Examples

Below are more examples demonstrating the use of the ‘Utils‘ Namespace. Don’t forget to include the module when running the examples!

QUICK NOTES:
The highlighted lines are sections of interest to look out for.

The code is heavily commented, so no further insight is necessary. If you have any questions, feel free to leave a comment below.

VB.NET || Roman Numeral Conversion – How To Convert Roman Numeral To Integer & Integer To Roman Numeral

The following is a program with functions which demonstrates how to convert roman numerals to integer, and integers to roman numerals.

The sample program implemented on this page was presented in a Data Structures course. This program was assigned in order to practice the use of the class data structure.


1. Roman Numeral Conversion

The example below demonstrates how to convert integers to roman numerals and roman numerals to integers.

QUICK NOTES:
The highlighted lines are sections of interest to look out for.

The code is heavily commented, so no further insight is necessary. If you have any questions, feel free to leave a comment below.

Once compiled, you should get this as your output

======= Decimal Test Start =======
Original = 1987
Converted = MCMLXXXVII
Converted Back To Original = 1987
======= Decimal Test End =======

======= Roman Test Start =======
Original = MCMXCI
Converted = 1991
Converted Back To Original = MCMXCI
======= Roman Test End =======

C++ || Roman Numeral Conversion – How To Convert Roman Numeral To Integer & Integer To Roman Numeral Using C++

The following is a program with functions which demonstrates how to convert roman numerals to integer, and integers to roman numerals.

The sample program implemented on this page is an updated version of a homework assignment which was presented in a C++ Data Structures course. This program was assigned in order to practice the use of the class data structure, which is very similar to the struct data structure.


1. Roman Numeral Conversion

The example below demonstrates how to convert integers to roman numerals and roman numerals to integers.

QUICK NOTES:
The highlighted lines are sections of interest to look out for.

The code is heavily commented, so no further insight is necessary. If you have any questions, feel free to leave a comment below.

Once compiled, you should get this as your output

======= Decimal Test Start =======
Original = 1987.000000
Converted = MCMLXXXVII
Converted Back To Original = 1987.000000
======= Decimal Test End =======

======= Roman Test Start =======
Original = McMxcI
Converted = 1991.000000
Converted Back To Original = MCMXCI
======= Roman Test End =======