Sunday, October 30, 2011

C++ Program to check whether a String or a Number is Palindrome using function overloading

The following C++ program uses function overloading to check if the entered string or number is palindrome using a overloaded function 'pal'.The function is overloaded by specifying two variants of attributes , the first one an integer for Number Palindrome and the second a character array for String Palindrome.
1)void pal(int n) 2)void pal(char a[])
The Complete Source Code is Provided Below.If you have any queries, Just comment on this Post.
 #include<iostream.h>  
 #include<conio.h>  
 #include<stdio.h>  
 #include<string.h>  
 //c-madeeasy.blogspot.com  
 void pal(char a[])  
 {  
 int i,j,l=0;  
 l=strlen(a);  
 int f=0;  
 for(i=0,l=l-1;a[i]!='\0';i++,l--)  
 {  
 if(a[i]!=a[l])  
 {  
 f=1;  
 break;  
 }  
 }  
 if(f==1)  
 {  
 printf("NoN Palindrome");  
 }  
 else if(f==0)  
 printf("Palindome");  
 }  
 void pal(int n)  
 {  
 int a,s=0,d;  
  a=n;  
 while(n>0)  
 {  
 d=n%10;  
 s=s*10+d;  
 n=n/10;  
 }  
 if(a==s)  
 cout<<"Palindrome";  
 else  
 cout<<"Non Palindrome";  
 }  
 void main()  
 {  
 clrscr();  
 int c=0;  
 do  
 {  
 cout<<"\n1.String Palindrome 2.Number Palindrome 3.Quit";  
 cout<<"\nEnter Choice: ";  
 cin>>c;  
 switch(c)  
 {  
 case 1:  
 cout<<"Enter the String: ";  
 char a[20];  
 cin>>a;  
 pal(a);  
 break;  
 case 2:  
 cout<<"Enter the Number: ";  
 int t;  
 cin>>t;  
 pal(t);  
 break;  
 case 3:  
 break;  
 default:  
 break;  
 }  
 }while (c!=3);  
 }  

C++ Program to Add ,Substract,Multiply and Divide Complex Numbers Using Operator Overloading

The following menu driven C++ program uses operator overloading to to perform Addition,Subtraction,Multiplication and Division of two complex numbers.Here Operators +,-,* and / are overloaded to perform the required operations with the desired objects.
eg:a*b in the terms of overloading means is to perform the '*' Operation associated with object a on object b.
The Complete Source Code is given below.If you have any Queries Just Comment on the Post.
 #include<iostream.h>  
 #include<conio.h>  
 #include<string.h>  
 #include<stdio.h>  
 class complex  
 {  
  int i,r;  
  public:  
  void read()  
  {  
  cout<<"\nEnter Real Part:";  
  cin>>r;  
  cout<<"Enter Imaginary Part:";  
  cin>>i;  
  }  
  void display()  
  {  
  cout<<"\n= "<<r<<"+"<<i<<"i";  
  }  
  complex operator+(complex a2)  
  {  
  complex a;  
  a.r=r+a2.r;  
  a.i=i+a2.i;  
  return a;  
  }  
  complex operator-(complex a2)  
  {  
  complex a;  
  a.r=r-a2.r;  
  a.i=i-a2.i;  
  return a;  
  }  
  complex operator*(complex a2)  
  {  
  complex a;  
  a.r=(r*a2.r)-(i*a2.i);  
  a.i=(r*a2.i)+(i*a2.r);  
  return a;  
  }  
  complex operator/(complex a2)  
  {  
  complex a;  
  a.r=((r*a2.r)+(i*a2.i))/((a2.r*a2.r)+(a2.i*a2.i));  
  a.i=((i*a2.r)-(r*a2.i))/((a2.r*a2.r)+(a2.i*a2.i));  
  return a;  
  }  
 };  
 void main()  
 {  
 int ch;  
 clrscr();  
 complex a,b,c;  
 do  
 {  
  cout<<"\n1.Addition 2.Substraction";  
  cout<<" 3.Mulitplication 4.Division 5.Exit\n";  
  cout<<"\nEnter the choice :";  
  cin>>ch;  
  switch(ch)  
  {  
  case 1:  
       cout<<"\nEnter The First Complex Number:";  
       a.read();  
       a.display();  
       cout<<"\nEnter The Second Complex Number:";  
       b.read();  
       b.display();  
       c=a+b;  
       c.display();  
       break;  
  case 2:  
       cout<<"\nEnter The First Complex Number:";  
       a.read();  
       a.display();  
       cout<<"\nEnter The Second Complex Number:";  
       b.read();  
       b.display();  
       c=b-a;  
       c.display();  
       break;  
  case 3:  
       cout<<"\nEnter The First Complex Number:";  
       a.read();  
       a.display();  
       cout<<"\nEnter The Second Complex Number:";  
       b.read();  
       b.display();  
       c=a*b;  
       c.display();  
       break;  
  case 4:  
       cout<<"\nEnter The First Complex Number:";  
       a.read();  
       a.display();  
       cout<<"\nEnter The Second Complex Number:";  
       b.read();  
       b.display();  
       c=a/b;  
       c.display();  
       break;  
  }  
  }while(ch!=5);  
 getch();  
 }  

Saturday, October 22, 2011

How to Repair and Play Corrupted Video Files or Unjoined(.001) files with Missing Parts :The Ultimate Guide






Sorry Post is under Inspection for Reported problem in one of the Third party Tools used for Repairing .Will re-post with a new tool Soon.



Thursday, October 13, 2011

How to Restore Closed Tabs in Firefox

Often there are situations in which you accidentally close a tab that you were using in Firefox.You don't need to dig up all the history to find the address of the website you were in.Just Follow these simple steps to restore closed tabs in firefox.
  • Go to Menu>History
  • There you will find a selection called Recently Closed Tabs.Click on it,you will find a list of recently closed webpages,Click on the one you want.Done! the page is back again.

Friday, October 7, 2011

Using DotNetZip to Compress all the Files in a Folder in C#

The inbuilt Compression class GzipStream class(System.IO.Compression) for C# does not provide the ability to compress all the files within a folder.You can do this by just few lines of code and just forgetting the techinical aspects behind it by using DotNetZip(Ioniczip).DotNetZip is a free class library that can be used for creating and editing zip files.

The project is Hosted at CodePlex check out http://dotnetzip.codeplex.com
To use DotNetZip Library in your C# Project follow these steps
  • Download the latest release from http://dotnetzip.codeplex.com/releases/
  • Add a Reference to DotNetZip from your project by going to Project> Add Reference .Browse for Ionic.Zip.dll in the release that you have downloaded.
  • Then add the reference in your project by adding the statement 'using Ionic.Zip'
  • Then use the code given below to create a zip file from a folder
 using (ZipFile zip = new ZipFile())  
 {  
   zip.AddDirectory(@"thefoldertoadd");  
   zip.Save("pathToSaveZipFile");  
 }  

Saturday, October 1, 2011

How to create a Toggle Button in C#(.NET)

Toggle Buttons are necessary controls that a programmer may require for developing winform applications,but
toggle button Control is not included in the Standard C# IDE as a Control but it can be created by using the CheckBox Control.

The following steps describes creating a Toggle Button Control from a check box Control in C#

  • Add a Check Box Control to the Windows Form Application Form from the Tool Box
     
  • Select the Check box and from the Property windows change the Property 'Appearance' from 'Normal' to 'Button'.
  • Done the Toggle Button is Created and is Ready to Go.To use it add the To Do code to its Check Changed Event.

Which is the Best Photo Watermarking Software

Photo Theft is becoming more and more common in the web with the outburst of social websites like Facebook,Google Plus and Image sharing se...