Skip to content

makannew/CPP-practice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C++ practice

In this repo I practice C++ programming through writing small basic programs. At this stage I have focused on solutions by using simple structures. Therefore, the programs have not enough protective constraints and they might be crashed by entering out of range inputs.

Credits

This repo is compiled by Makan Edrisi

Here is the list of solutions and codes.

Using simplified Bailey–Borwein–Plouffe formula (The BBP formula for π)to generate PI number. It gets number of decimal digits from user then displays pi and refrenced pi for comparison. The limit of acuracy is about 16 decimal digits as a result of using a long double variable for pi number.

It gets a number from user then displays all prime factors. At the end it checks if the number itself is a prime number or not. I tryed my best to find simplest solution without any unnecessary calculation to solve the problem.

e (mathematical constant) as base of the natural logarithm can be calculated as the sum of the infinite series. It adds series calculations to satisfy 16 decimal digits precision of long double data type.

Practice of using bubble sort algorithm to sort array of numbers. It is not very efficient but it can detect already sorted list in first pass.

Here is an explanation about merge-sort algorithm. My solution is a bottom-up merge sort whith the difference that it predicts sublist exactly same as top-down sublists. So it is more efficient and also can be used for in-place merge-sorting because for entire stages lenghts of two compared sublist always have maximum 1 difference.

About

C++ practice through writing small basic programs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages