Generating Random Number in C/C++
C Standard Library provides two different methods to generate random numbers. They are: rand() and srand().
Read MorePosted by M. Saqib | Updated Feb 13, 2021 | C Programming Source Code |
C Standard Library provides two different methods to generate random numbers. They are: rand() and srand().
Read MorePosted by M. Saqib | Updated Feb 19, 2021 | C++ Source Code |
This program will solve quadratic equations. It accepts coefficients of a quadratic equation from the user i.e. a, b and c and displays the roots. To compile the program name it quadratic_solver.cpp then type g++ -o quadratic_solver quadratic_solver.cpp You may need to use math.h like this: #include if you are using windows C++ programming software. (I tried it without the math.h and got an “undeclared identifier” error)
Read MorePosted by M. Saqib | Updated Feb 13, 2021 | C Programming Source Code |
This article is about a collection of common Computer Science algorithms which may be used in C projects. The C Programming Language has a much smaller Standard Library as compared to other more modern programming languages such as Java or Python. The library provides a basic set of mathematical functions, string manipulation, type conversions, and file and console-based I/O.
Read MorePosted by M. Saqib | Updated Jun 26, 2020 | C Programming Tutorials |
In C Programming, ternary operator allows executing different code depending on the value of a condition. The returned value is the result of the expression when the code is executed. The main advantage of using ternary operator is to reduce the number of lines of code and improve the performance of application. In C, the real utility of ternary operator is that it is an expression instead of a statement i.e. you can have it on the right-hand side (RHS) of a statement. So you can write certain code statements more concisely.
Read MorePosted by M. Saqib | Updated Jun 26, 2020 | C++ Programming Tutorials |
In C++, ternary operator allows executing different code depending on the value of a condition, and the result of the expression is the result of the executed code. The ternary operator uses 3 operands. It evaluates a condition and after that chooses one of its two branches to execute, depending upon the result of condition. The symbol for ternary operator is “? :”. The syntax for the ternary operator is: ? : ;
Read MorePosted by M. Saqib | Updated Jan 31, 2021 | C Programming Source Code |
Originally written in 1979 at Computer Laboratory, Cambridge (England), it was reprinted in 1997 in the book “Readings in Information Retrieval”. Initially it was written in BCPL language. Here is the list of implementations in other programming languages including C, Java and Pearl implementations done by author himself.
Read MorePosted by M. Saqib | Updated Jun 26, 2020 | C++ Source Code |
This is a C++ implementation of adding time using structures. A structure is a convenient tool for handling a group of logically related data items. Structure help to organize complex data is a more meaningful way. It is powerful concept that we may after need to use in our program Design.
Read More