Fibonacci Sequence

C++ → Basics → Input → Arithmetic → Conditions → Loops → Array → Functions → Random Numbers → Fibonacci sequence Generate Fibonacci Numbers in C++ using for, while and do-while loops. Fibonacci sequence starts with 1, 1 and than adds previous two elements. Consider the following first 10 elements of a Fibonacci Sequence. In the end, there is […]

C++ Dice Rolls Sum Calculated

C++ → Basics → Input → Arithmetic → Conditions → Loops → Array → Functions → Random Numbers → Dice Roll and Sum → Dice Roll, Sum, and Counter Random Numbers and Related Programs Random Numbers Basics Dice Roll and Random Numbers Dice Roll, Sum and Counter (You are here) Before trying these programs you should have a look […]

C++ Dice and Random Numbers

C++ → Basics → Input → Arithmetic → Conditions → Loops → Array → Functions → Random Numbers → Dice Roll and Sum Random Numbers and Related Programs Random Numbers Basics Dice Roll and Random Numbers (You are here) Dice Roll, Sum and Counter Before trying these programs you should have a look at the basics of random numbers to […]

C++ Random Numbers

C++ → Basics → Input → Arithmetic → Conditions → Loops → Array → Functions → Random Numbers Random Numbers and Related Programs Random Numbers Basics (You are here) Dice Roll and Random Numbers Dice Roll, Sum and Counter Learn how to generate uniformly distributed random numbers as integers and double in C Plus Plus. The following programs […]

Passing Arrays to Functions

C++ → Basics → Input → Arithmetic → Conditions → Loops → Array → Multidimensional Arrays → Functions → Passing Arrays to Functions How to pass arrays into functions in C++ Construction and Examples. We can pass arrays in functions. For example, #include <iostream> using namespace std; const int num = 5; //array size void myfunc(int myarray[]); //passing array […]

Functions

C++ → Basics → Input → Arithmetic → Conditions → Loops → Array → Multidimensional Arrays → Functions The functions in C++ Construction and Examples. We can also make functions outside the main function. First of all consider this simple C++ program. #include <iostream> using namespace std; int main() { cout << “Print it on the screen!” << […]

Multidimensional Arrays

C++ → Basics → Input → Arithmetic → Conditions → Loops → Array → Multidimensional Arrays The multidimensional arrays in C++ Construction and Examples. The multidimensional arrays are arrays within an array. For example, an array with two rows and three columns 1   2   3 4   5   6 can be written as #include […]

Array

C++ → Basics → Input → Arithmetic → Conditions → Loops → Array The arrays in C++ Construction and Examples. The arrays are used when we have large data of same nature. Construction: Array type name [size]; For example, consider the array of type integer and size 5. #include <iostream> using namespace std; int main() { […]

Do-While Loop

C++ → Basics → Input → Arithmetic → Conditions → Loops → for loop → while loop → The do-while loop The do – while loop in C++. Construction and Examples. The do – while loop is used when we have to run a program until a given condition is true. Construction: The do – while loop […]

While Loop

C++ → Basics → Input → Arithmetic → Conditions → Loops → for loop → The while loop The while loop in C++. Construction and Examples. The while loop is used when we have to run a program over and over again, and not know for how many of times. Construction: The while loop while(condition) { […]