Saturday, 22 July 2017

Write a program to calculate the area of different shapes (circle, square, triangle, rectangle) using function overloading.

Coding:

#include<iostream.h>
#include<math.h>

#include<conio.h>
#define PI 3.141
class Shape
{
 float a;
 public:
    void area(int r);
    void area(float s);
    void area(float l,float b);
    void area(float a,float b,float c);
};
void Shape::area(int r)
{
  a=float(PI*r*r);
  cout<<"\nArea of Circle is:"<<a;
}
void Shape::area(float s)
{
 a=pow(s,2);
 cout<<"\nArea of Square is:"<<a;
}
void Shape::area(float l,float b)
{
  a=l*b;
  cout<<"\nArea of Rectangle is:"<<a;
}
void Shape::area(float a,float b,float c)
{
  float s;
  s=(a+b+c)/2;
  a=sqrt(s*(s-a)*(s-b)*(s-c));
  cout<<"\nArea of Tringle is:"<<a;
}
void main()
{
  clrscr();
  float k=6.5;
  Shape s;
  s.area(5);
  s.area(k);
  s.area(5,6.5);
  s.area(10,15.5,6.8);
  getch();
}


Output:


Wednesday, 7 June 2017

Create two classes DM and DB which store the value of distances. DM stores distances in metres and centimeters and DB in feet and inches.

Write  a program that can read values for the class  objects and add one object DM with another object of DB. Use a Friend Function to carry out  the addition operation. The object that stores the results may be a DM object or DB object, depending on the units in which the





Coding:

#include<iostream.h>
#include<conio.h>
class DB;
class DM
{
 float meter,centi;
 public:
 void getdata()
 {
  cout<<"\nEnter the distance in(meter-centimeter):";
  cin>>meter>>centi;
 }
 void display()
 {
  cout<<"\nThe distance is:";
  cout<<meter<<" meters and "<<centi<<" centimeter";
 }
 friend void add(DM &,DB &);
};
class DB
{
 float inch,feet;
 public:
 void getdata()
 {
  cout<<"\nEnter the distance in(feet-inch):";
  cin>>feet>>inch;
 }
 void display()
 {
  cout<<"\nThe distance is:";
  cout<<feet<<" feet and "<<inch<<" inch";
 }
 friend void add(DM &,DB &);
};
void add(DM &a,DB &b)
{
 int ch;
 cout<<"\nPress 1 for meter-centi:";
 cout<<"\nPress 2 for feet-inch:";
 cout<<"\nEnter your choice:";
 cin>>ch;
 if(ch==1)
 {
  DM d;
  int c=(a.meter*100+a.centi+b.feet*30.48+b.inch*2.54);
  if(c>=100)
  {
   d.meter=c/100;
   d.centi=c%100;
  }
  else
  {
   d.meter=0;
   d.centi=c;
  }
  d.display();
 }
 else
 {
  DB d;
  int i=(a.meter*39.37+a.centi*.3937008+b.feet*12+b.inch);
  if(i>=12)
  {
   d.feet=i/12;
   d.inch=i%12;
  }
  else
  {
   d.feet=0;
   d.inch=i;
  }
  d.display();
 }
}
void main()
{
 clrscr();
 DM a;
 DB b;
 a.getdata();
 b.getdata();
 add(a,b);
 getch();

}


Output:


Thursday, 1 June 2017

अब आपका कंप्यूटर भी बात करेगा (Your computer will talk now)

इसके माध्यम से आप अपने कंप्यूटर को बात करना सकते हैं। तो और देर नहीं करके चले और जानें कैसे कम्प्यूटर को बात करना है।


पहले नोटपैड खोलें।

Figure-1


 अब नीचे दिए गए कोड कॉपी करें नोटपैड- पेस्ट करें।

msg=InputBox("Enter your text","Talk it")
Set sapi=CreateObject("sapi.spvoice")
sapi.Speak msg


Figure-2


इस बार File-Save As.. पर जाएँ और किसी भी नाम(dot)Vbs सेव करें (aaa. vbs)


Figure-3


 Save करने के वाद इसे खोलें और कम्प्यूटर से आप जो कहना चाहते हैं, ओ लिखकर OK- क्लिक करें। 



Figure-4


Figure-5

Thank You


Monday, 29 May 2017

किसी भी सॉफ्टवेयर के बिना फेसबुक वीडियो को कैसे डाउनलोड करें(How to download facebook video without any software)

facebook video
आज की पोस्ट का विषय बहुत अच्छा है। इस पोस्ट में मैं कैसे आप किसी भी सॉफ्टवेयर के बिना किसी भी फेसबुक वीडियो डाउनलोड कर सकते तुम्हें दिखाता हूँ।


इस वीडियो को देखने के बाद आपको फेसबुक पर एक वीडियो डाउनलोड करने के लिए ओर कोई सॉफ्टवेयर की जरुरत नहीं। एक नजर डालें कैसे सॉफ्टवेयर के बिना फेसबुक की वीडियो डाउनलोड करेंगे।





आप इस वीडियो को पसंद करते हैं तो शेयर करने के लिए मत भूलना।और भी टिप्स एंड ट्रिक्स पाने के लिए हमारे चैनल को सब्सक्राइब करें और अधिक देखते रहे।


कई लोगों को लगता है कि मैं हमारे वीडियो को दर्शक बढ़ाने के लिए कर रहा हूँ। इनकार नहीं करेंगे।  लेकिन लिखने की तुलना में अधिक वीडियो देखने मे आप सीख सकते हैं।

Friday, 19 May 2017

Write a Program to implement first Pattern Matching Algorithm to find the location of Given Pattern (P) in A Given Text (T).

Coding:

#include<iostream.h>
#include<string.h>
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
  clrscr();
  int k,max,index,t_len,p_len;
  char a[50],p[10];
  cout<<"\nEnter any text:";
  gets(a);
  cout<<"\nEnter pattern:";
  gets(p);
  t_len=strlen(a);
  p_len=strlen(p);
  k=0;
  max=t_len-p_len+1;
  while(k<max)
  {
   for(int i=0;i<p_len;i++)
   {
    if(p[i]!=a[k+i])
    {
      index=0;
      k++;
      break;
    }
    else
    {
      index=k;
      cout<<"\nPattern is exist In given text and position is:"<<index;
      getch();
      exit(0);
    }
   }
  }
  if(index==0)
  cout<<"\nPattern does not Exist:";
  getch();
 }


Output:

Thursday, 18 May 2017

Define a class Age with data members: Years, Months & Days. Write a program to add three different values of Age by using Object as arguments concept & also return final result by using object.

Coding:

#include<iostream.h>
#include<conio.h>
class Age
{
  int YY,MM,DD;
  public:
       void getdata();
       void Add(Age,Age);
       void display();
};
void Age::getdata()
{
  cout<<"\nEnter Age of Person(DD.MM.YY):";
  cin>>DD>>MM>>YY;
}
void Add(Age a1,Age a2)
{
  Age a;
  a.MM=0;
  a.DD=a1.DD+a2.DD;
  if(a.DD>=30)
  {
   a.MM=a.DD/30;
   a.DD=a.DD%30;
  }
  a.MM+=a1.MM+a2.MM;
  if(a.MM>=12)
  {
   a.YY=a.MM/12;
   a.MM=a.MM%12;
  }
  a.YY+=a1.YY+a2.YY;
   a.display();
}
void Age::display()
{
  cout<<"\nAddition of Two date is:\n";
  cout<<"\t\t"<<"\nDD:"<<DD<<"\nMM:"<<MM<<"\nYY:"<<YY;
}
void main()
{
  clrscr();
  Age a,b,c;
  a.getdata();
  b.getdata();
  c=Add(a,b);
  getch();
}


Output:

Wednesday, 17 May 2017

Write a program to test your class.

Define a class named Student, create following members in it: Data Members: student_name, rollno, class (BCA/MCA), semester, sub1_marks,sub2_marks, sub3_marks,  total marks, average, percentage.                                   
          Member Functions: 
To enter the information of a student. 
To calculate his/her total, average, percentage.
To display the result.  

Write a program to test your class.


Coding:

#include<iostream.h>
#include<stdio.h>
#include<conio.h>
class student
{
  int roll,total_marks,sub1_marks,sub2_marks,sub3_marks;
  char stu_name[20],clss[3],sem[10];
  float avg,percentage;
  public:
     void getdata();
     void calculation();
     void display();
};
void student::getdata()
{
  cout<<"\nEnter Student Name:"<<" ";
  gets(stu_name);
  cout<<"\nEnter Student Roll No.:"<<" ";
  cin>>roll;
  cout<<"\nEnter class:"<<" ";
  gets(clss);
  cout<<"\nEnter semester:"<<" ";
  gets(sem);
  cout<<"\nEnter subject marks:"<<" ";
  cin>>sub1_marks>>sub2_marks>>sub3_marks;
}


void student::calculation()
{
  total_marks=sub1_marks+sub2_marks+sub3_marks;
  avg=total_marks/3;
  percentage=total_marks*100/300;
}
void student::display()
{
  cout<<"\nThe Result is:\n";
  cout<<"\nTotal Marks="<<total_marks;
  cout<<"\nAverage Marks="<<avg;
  cout<<"\nPercentage Marks="<<percentage;
}
void main()
{
 clrscr();
 student stu;
 stu.getdata();
 stu.calculation();
 stu.display();
 getch();

}

Output: