Operaciones aritméticas de fracciones en visual basic

New product

Learn how to perform the addition, subtraction, multiplication and division of fractions in the basic visual network. With your source code totally free.

Arithmetic operations of fractions in visual basic net

To perform addition and subtraction of fractions in Visual Basic NET, we need to create a structure that allows us to handle them, this is because the language does not give us native support for rational numbers.

The structure NumeroRacional

In this case, implement a structure that I called NumeroRacional which consists of the following:

estructura numero racional

Properties:

D: Denominator

N: Numerator

Methods / Functions

ConvertDecimalaRacional: This method changes a decimal number with mantissa to its fractional equivalent. This is the one used by commercial calculators.

DarListaFracciones: Gives a list of approximate rational numbers to the decimal number given by "d". This method is used by ConvertDecimalaRacional.

DarMaximoNumerador: Remove the comma from the decimal number given by f. This method is used by ConvertDecimalaRacional.

Evaluate: Evaluate a text string and extract the fractions that are enclosed in parentheses.

mcd: Calculates the Maximum Common Divider between two given numbers

mcdFast: Calculates the Maximum Common Divider between two numbers given much faster.

Reduce: Reduce the fraction to its minimum expression. Particular variation of the Euclid algorithm to simplify fractions.

Use of the NumeroRacional class

It's simple enough to use.

To create a rational number:

Simple statement:

Dim Fraccion As NumeroRacional

You can also create fractions from

text:

Dim Fraccion As New NumeroRacional("1/2")

Numero decimal

Dim Fraccion As New NumeroRacional(0.5)

Give individual parameters directly

Dim Fraccion As New NumeroRacional(1,2)

The structure also has the usual arithmetic operators implemented, so it can easily add two fractions directly in the code to be readable.

Dim Fraccion1, Fraccion2, resultado As NumeroRacional

Fraccion1 = New NumeroRacional("1/2")
Fraccion2 =
New NumeroRacional("1/4")
resultado = Fraccion1 + Fraccion2

As you can see, performing the arithmetic operations with the structure is very simple.

Example program of addition, subtraction, multiplication and division of fractions:

Fractions is a small program that performs arithmetic operations with n fractions. Written in a simple way, without much error handling so that the reader can focus on how the NumeroRacional structure works.

programa para calcular fracciones en visual basic

Requirements:


Compiler compatible with VB.NET 4.0 or higher.

Advertising

**publicidad**

Download code for fractions:


Download Complete source code of fractions

Only download the executable fractions


Totally free of viruses and malicious software, so do not wait any longer to download it now.

Do not forget to give us an opinion about the program, to improve the content.

Escrito por:

Elimar

Eliprograma

28/06/2019

Grade 
06/28/2019

Me gusto

Muy buen programa eli. Simple de usar.

    Write your review!

    Write a review

    Operaciones aritméticas de fracciones en visual basic

    Operaciones aritméticas de fracciones en visual basic

    Learn how to perform the addition, subtraction, multiplication and division of fractions in the basic visual network. With your source code totally free.

    Ask a question

    NO registration required!

    If the question you have has not yet been answered here, use the form below to ask something about this addon.

    (optional)
    *(Required to be notified when an answer is available)

    If the download link redirects to another product that is not described in the article or is broken, report it using our Reporting Form