C and C++

Characteristics of C Programming languages

Direct access to memory layout through pointer manipulation Concise syntax, small set of keywords Block structured language Some encapsulation of code, via functions Type checking (pretty weak) C is portable(program written for one computer can be run on another computer with little modification) C has an ability to extend itself. C was invented to write […]

Explain Flowcharts C and C++ Data Structures

Explain Flowcharts

It is a diagram showing a sequence of activities to be performed for the solution of a problem. • A set of conventional symbols are used to draw flowcharts • Graphically depicts the logical steps to carry out a task and shows how the steps relate to each other. • An organized combination of shapes, […]

C and C++

Program to converting degree to radian using type conversion

In C++ programming, understanding type conversion is essential for precise mathematical computations. One common real-world application is converting angles from degrees to radians. This is especially useful in trigonometry, graphics, physics simulations, and embedded systems. In this tutorial, we’ll write a C++ program to convert degrees to radians using type conversion to ensure accuracy in […]

Program to convert decimal to binary using templates

Templates in C++ allow you to write generic and reusable code. By using function templates, you can create flexible functions that work with various data types. In this tutorial, you’ll learn how to write a C++ program to convert a decimal number to binary using a function template, enhancing both your understanding of binary number […]

Program to convert cartesian co-ordinates into polar co-ordinates C and C++

Program to convert cartesian co-ordinates into polar co-ordinates

#include<iostream.h> #include<math.h> class rect { private: float x, y, r, t; public: rect(); void polar(); void disp(); }; rect::rect() { cout<<“\n Enter x cordinate: “; cin>>x; cout<<“\n Enter the y cordinate: “; cin>>y; } void rect::polar() { r = sqrt(x*x+y*y); if(y<0) { if(x<0) { t = 180+tan(y/x)*180/3.14159265; } else t = tan(y/x)*180/3/14159265; } if(x>0 && […]

Program to add and multiply two matrix using OOP C and C++

Program to add and multiply two matrix using OOP

#include class matrix { private: int m, z[10][10]; public: int i, j, k; void getdata(); { cout<<“Enter the order of the square matrix: “; cin>m; cout<<“Enter the “<<m<<“*”<<m<<” elements: “<<endl; for(i=0;i<m;i++) for(j=0;j<m;j++) cin>>z[i][j]; } friend int check(matrix a, matrix b) { if(a.m == b.m) return 1; else return 0; } void display() { cout<<“Size is […]

Program to generate fibonacci series using constructor C and C++

Program to generate fibonacci series using constructor

#include<iostream.h> class fib { int n; public: fib(int a) { n = a; } fib() { n = 0; } void display() { if(n == 0) { cout<“\n No fibonacci number\n”; retun; } else if(n == 1) { cout<<“Fibonacci numbers are\n”<<“0″<<endl; return; } else if(n>2) { cout<<“Fibonacci numbers are\n”<<“0\t1”; } if f1=0,f2=1,f3,cnt; for(cnt = 1;cnt […]