Sunday, 4 October 2020

How to make Dice Rolling Simulator (Dice Simulator)

In this post, we will learn and develop a dice simulator step by step. The dice rolling algorithm will have the following steps:
  1. create a random number
  2. check the number
  3. print the face
  4. looping
1. Create a random number 

First import the random module for creating a random number.
 


Now print a face for the obtained random number. 




At the final Step, loop through until the user gives input yes or no for rolling the dice. This is the dice simulator which prints the face to a given random number.


Sunday, 14 June 2020

C++ Encapsulation - Creating Class with Setters and Getters Functions

Here, we will learn how to create a class with setter and getter methods in C++ programming language.

In the below C++ program, we have created a class with setter and getter methods.


You can do download source code from here: sourcecode

Thursday, 11 June 2020

C++ Program to find Factorial using Class and Object Concept

In this Program, we will create a class Factorial that will compute the factorial of the given positive number using class and object concept in c++ language.