Employee Details Using Structure (c++)

 #include <iostream>

#include <string>

using namespace std;

struct Employee{

    int Emp_ID, age;

    string fname, lname, department;

    char sex;

};


int main() {

  struct Employee em;

  cout<<"Enter Your Employee_ID: ";

  cin>>em.Emp_ID;

  cout<<"Enter Your Employee Age: ";

  cin>>em.age;

  cout<<"Enter Your First Name and Last Name: ";

  cin>>em.fname>>em.lname;

  cout<<"Enter Employee Department: ";

  cin>>em.department;

  cout<<"Enter Your Sex ";

  cin>>em.sex;

  cout<<endl;

  cout<<"Employee ID is:"<<em.Emp_ID<<endl;

  cout<<"Employee Age is: "<<em.age<<endl;

  cout<<"Employee First Name is "<<em.fname<<endl<<"Employee Last Name is " <<em.lname<<endl;

  cout<<"Employee Department: "<<em.department<<endl;

  cout<<"Employee Sex is: "<<em.sex<<endl;

    return 0;

}

Fibonacci using recursion(c++)

 #include <iostream>

using namespace std;

int fibo(int n)

{

        if((n==1)||(n==0))

        {

                return(n);

        }

        else

        {

                return(fibo(n-1)+fibo(n-2));

        }

}

int main() {

    int n = 5,i=0;

    while(i<n){

        cout<<" "<<fibo(i);

        i++;

    }

    return 0;

}

Program to access Element in Array

 #include <iostream>

#define m 100

using namespace std;


int main()

{

    int arr[m][m],r,c,i,j;

    cout<<"Enter Your Number of Row and Column: ";

    cin>>r>>c;

    for(i=0;i<r;i++){

          for(j=0;j<c;j++){

                cout<<"Enter "<<i<<" Row "<<j<<" Column :";

                cin>>arr[i][j];

          }

    }

    for(i=0;i<r;i++){

    for(j=0;j<c;j++){

          cout<<arr[i][j]<<" ";

      }

    cout<<endl;

    }

    cout<<"Enter Your Row and Column and you want to access: ";

    cin>>r>>c;

    cout<<"Your Element is "<<arr[r][c];

    return 0;

}


Operator Overloading in C++

#include<iostream> using namespace std; class Complex { private: int real, imag; public: Complex(int r = 0, int i = 0){       re...