Read More »
Saturday, March 29, 2014
Friday, March 28, 2014
PD-Proxy Bandwidth limit reached solution
PD-Proxy is the one of the best and most used VPN( Virtual Provate Network) around the world. Well, PD-Proxy trial has maximum of 100 mb/account per day for downloading and uploading. after using 100mb, bandwidth limit reaches in a trial account, So you need to upgrade your account to use more data and you also won't have any limit for using it, But you have to pay extra $5 per month.
In a trial account after using 100mb suddenly PD-Proxy disconnects and message occurs saying,
Bandwidth limit reached!
Please upgrade your account to premium to continue browsing!
Tunnel successfully connected!
Solution to the bandwidth limit reached in PD-Proxy:-
- First Download Volumeid.exe from here(It is an official program from microsoft ).
- Now extract and copy it to the C:\windows\system32 folder.
- Run command prompt with administrator privilage.
- type volumeid.exe C: xxxx-xxxx ( where x represents any number) (eg. volumeid.exe C: 5345-3435) and press enter.
- If you are doing this for first time a new popup window will open accept the license from microsoft.
- Exit the command prompt and restart the computer.
Now you can use again PD-Proxy after bandwidth limit reached. And make sure PD-Proxy account should be an another account not the same which has been reached its limit. Now enjoy surfing the internet.
Wednesday, March 26, 2014
Constructor Example
#include<iostream.h>
#include<conio.h>
class Number
{
int m,n;
public:
Number();
void display()
{
cout<<"m = "<<m;
cout<<"n = "<<n;
}
};
Number::Number()
{
m=5;n=6;
}
void main()
{
Number num;
num.display();
getch();
}
#include<conio.h>
class Number
{
int m,n;
public:
Number();
void display()
{
cout<<"m = "<<m;
cout<<"n = "<<n;
}
};
Number::Number()
{
m=5;n=6;
}
void main()
{
Number num;
num.display();
getch();
}
Overloading Constructor Example
#include<iostream.h>
#include<conio.h>
class Number
{
int m,n;
public:
Number()//Non-Parameterisze Constructor.
{m=5;
n=6; }
Number(int a, int b)//Parameterisze Constructor.
{
m=a;n=b;
}
Number (int a)//Parameterisze Constructor.
{m=n=a;
}
void display()
{
cout<<"M = "<<m;
cout<<"N = " <<n;
}
};
void main()
{
Number num;
Number num2(5);
Number num3(5,6);
num.display();
num2.display();
num3.display();
getch();
}
#include<conio.h>
class Number
{
int m,n;
public:
Number()//Non-Parameterisze Constructor.
{m=5;
n=6; }
Number(int a, int b)//Parameterisze Constructor.
{
m=a;n=b;
}
Number (int a)//Parameterisze Constructor.
{m=n=a;
}
void display()
{
cout<<"M = "<<m;
cout<<"N = " <<n;
}
};
void main()
{
Number num;
Number num2(5);
Number num3(5,6);
num.display();
num2.display();
num3.display();
getch();
}
Tuesday, March 25, 2014
Overloading Logical less Operator
//Overloading Logical Operator "<"
#include<iostream.h>
class Point
{
private:
double M_dX, M_dY;
public:
Point(double dX=0.0, double dY=0.0)
{
M_dX=dX;
M_dY=dY;
}
friend bool operator<(Point &P1, Point &P2);
};
bool operator<(Point &P1, Point &P2)
{
return(P1.M_dX<P2.M_dX && P1.M_dY<P2.M_dY);
}
int main()
{
Point P1(4.55,6.0), P2(4.55,6.0); //Change the value of argument however you like
if(P1<P2)
cout<<"P1<P2=True";
else
cout<<"P1<P2=False";
return(0);
}
#include<iostream.h>
class Point
{
private:
double M_dX, M_dY;
public:
Point(double dX=0.0, double dY=0.0)
{
M_dX=dX;
M_dY=dY;
}
friend bool operator<(Point &P1, Point &P2);
};
bool operator<(Point &P1, Point &P2)
{
return(P1.M_dX<P2.M_dX && P1.M_dY<P2.M_dY);
}
int main()
{
Point P1(4.55,6.0), P2(4.55,6.0); //Change the value of argument however you like
if(P1<P2)
cout<<"P1<P2=True";
else
cout<<"P1<P2=False";
return(0);
}
Inheritance example in C++
#include<iostream.h>
#include<conio.h>
class First
{
char name[40];
int age;
void getdata()
{
cout<<"Enter Your name : ";
cin>>name;
cout<<"Enter Your age : ";
cin>>age;
}
public:
void display()
{
getdata();
cout<<"Your name is : "<<name;
cout<<"\nYour age is : "<<age;
}
};
class Second : public First
{
public:
void display2()
{
display();
}
}b;
int main()
{
b.display();
getch();
}
#include<conio.h>
class First
{
char name[40];
int age;
void getdata()
{
cout<<"Enter Your name : ";
cin>>name;
cout<<"Enter Your age : ";
cin>>age;
}
public:
void display()
{
getdata();
cout<<"Your name is : "<<name;
cout<<"\nYour age is : "<<age;
}
};
class Second : public First
{
public:
void display2()
{
display();
}
}b;
int main()
{
b.display();
getch();
}
Monday, March 24, 2014
C Tutorials
- Addtion using function
- Ascending Order of given integer
- C Program to check whether anagrams or not
- C Program to generate Armstrong Numbers
- C program to Display Hello World !
- C program to check whether it is prime or not
- C program to get IP address
- C program to implement Queue using Function
- C program to implement Stack operation
- C program to merge files
- C program to print Floyd's triangle
- C program to read files
- C programming Books
- C/C++ Compiler
- Factorial Number using Recursion
- Fibonacci Series
- Function Example with switch statement
- Graphics example in C
- HCF and LCM in C
- Loop example in C
- Make color changing in C programming of certain string.
- Multiply Two matrix from C
- Odd numbers from 50 to 100
- Program To Display Pyramid of Numbers
- Program to Calculate Net salary
- Program to Display ASCCI Value of charater
- Program to Display whether it is Armstrong or not
- Program to calculate Factorial Number
- Program to calculate Multiplication table of Given Integer
- Program to calculate Simple Interest
- Program to calculate result of student using nested if statement
- Program to display current time
- Program to find Address of character
- Program to find Greatest Number in Array
- Program to swap value using function call by refference
- Reverse any String
- Reverse pyramid in c
- Shut down program in C
- Simple Billing System Program in C
- Simple Quiz using switch statement
- Structure example in C
- Sum of Matrix
- Union Example
- WI FI hotspot in C
- check whether palindrome or not
- fibonacci series using recursion
Sunday, March 23, 2014
Saturday, March 22, 2014
How to remove subscribe to post atom
- Go to Blogger Template >>Edit HTML and press ctrl+F and serach for this code
<b:include data='feedLinks' name='feedLinksBody'/> |
- Now remove the above code and save it
How to add Read more Post on Blogger
- Go to Blooger Template >> Edit Html and Press ctrl+f and type this code <data:post.body/> and hit enter twice and replace this with below code.
<b:if cond='data:blog.pageType != "item"'> <b:if cond='data:blog.pageType != "static_page"'> <div expr:id='"summary" + data:post.id'><data:post.body/></div> <script type='text/javascript'>createSummaryAndThumb("summary<data:post.id/>");</script> <span class='readmore' style='float:right'><a expr:href='data:post.url'>Read More »</a></span></b:if></b:if> <b:if cond='data:blog.pageType == "item"'><data:post.body/></b:if> <b:if cond='data:blog.pageType == "static_page"'><data:post.body/></b:if> |
- Now search for </head> and just above </head> Paste the below code.
<script type='text/javascript'> posts_no_thumb_sum = 490; posts_thumb_sum = 400; img_thumb_height = 120; img_thumb_width = 120; </script> <script type='text/javascript'> //<![CDATA[ function removeHtmlTag(strx,chop){ if(strx.indexOf("<")!=-1) { var s = strx.split("<"); for(var i=0;i<s.length;i++){ if(s[i].indexOf(">")!=-1){ s[i] = s[i].substring(s[i].indexOf(">")+1,s[i].length); } } strx = s.join(""); } chop = (chop < strx.length-1) ? chop : strx.length-2; while(strx.charAt(chop-1)!=' ' && strx.indexOf(' ',chop)!=-1) chop++; strx = strx.substring(0,chop-1); return strx+'...'; } function createSummaryAndThumb(pID){ var div = document.getElementById(pID); var imgtag = ""; var img = div.getElementsByTagName("img"); var summ = posts_no_thumb_sum; if(img.length>=1) { imgtag = '<span class="posts-thumb" style="float:left; margin-right: 5px;"><img src="'+img[0].src+'" width="'+img_thumb_width+'px" height="'+img_thumb_height+'px"/></span>'; summ = posts_thumb_sum; } var summary = imgtag + '<div>' + removeHtmlTag(div.innerHTML,summ) + '</div>'; div.innerHTML = summary; } //]]> </script> |
- And save it.
Friday, March 21, 2014
List of Nepali Band
- Nepathya
- 1974 AD
- Robin and the New Revolution
- Albatross
- Akarshan
- Antim Grahan
- Anuprastha
- Astha
- Axix
- Bidroha
- Bro-Sis
- Buds
- Catch 22
- Cobweb
- Crossroads (Sanjay Shrestha)
- Cruentus
- Blackout
- Deurali Band
- Dying Out Flame
- Horny Monks
- Jindabaad
- Jugaa
- The Lakhey
- Kandara
- Karma Band
- Kutumba Band
- Mantra
- Metal Cross
- Milestone
- Mukti N Revival
- Mongolian Hearts (Raju Lama)
- Monkey Temple
- Newaz
- Newa the King
- Navras 'N' The Students
- Okely
- Rockheads
- Seasons Band (Sujil Karmacharya)
- Sayaas
- Shannon Scam
- Sur Sudha
- Stings
- Prism
- The Himalayan Band
- The Axe
- The 11th Hour
- The Edge
- The Influence (Bhim Tuladhar)
- The Move (Dhiraj Rai)
- The Shadows
- The Uglyz
- The Yellow Hammer
- Underside[1]
- White
- X-Mantra
- Zenith
How to remove older/newer/home link from Blog
- How to remove Newer posts link ?
- Go to Template << Edit HTML << and search for following code.
#blog-pager-newer-link{background: |
- Now just copy the below code and paste after/below the #222;float:left;padding:4px} .
#blog-pager-newer-link {display:none;} |
And save it.2. How to remove Older posts link ?
- Search for following code.
#blog-pager-older-link{background: |
- Now just copy the below code and paste after/beow the code #222;float:right;padding:4px}
#blog-pager-older-link {display:none;} |
And save it.3.How to remove Home link ?
- search for following code.
.home-link {background: |
- Now just copy the below code and paste after/below the #222;float:left;padding:4px} code.
#blog-pager .home-link {display:none;} |
And Save it.
How to change font size of posts on blogger
- Go to Template >> Edit HTML >> and search for ".post-body{" (without quot).
- then you will see following code.
.post-body{margin:0px;padding:0px 16px 0px 0px;font-family:Arial, Helvetica, Sans-serif;font-size:15px;line-height: 20px;} |
- Now change 15 to your desired size.
Thursday, March 20, 2014
Overloading Logical 'Greater' or '>' Operator
//Overloading Logical Operator ">"
#include<iostream.h>
class Point
{
private:
double M_dX, M_dY;
public:
Point(double dX=0.0, double dY=0.0)
{
M_dX=dX;
M_dY=dY;
}
friend bool operator>(Point &P1, Point &P2);
};
bool operator>(Point &P1, Point &P2)
{
return(P1.M_dX>P2.M_dX && P1.M_dY>P2.M_dY);
}
int main()
{
Point P1(6.0,7.1), P2(5.0,6.0); //Change the value of argument however you like
if(P1>P2)
cout<<"P1>P2=True";
else
cout<<"P1>P2=False";
return(0);
}
#include<iostream.h>
class Point
{
private:
double M_dX, M_dY;
public:
Point(double dX=0.0, double dY=0.0)
{
M_dX=dX;
M_dY=dY;
}
friend bool operator>(Point &P1, Point &P2);
};
bool operator>(Point &P1, Point &P2)
{
return(P1.M_dX>P2.M_dX && P1.M_dY>P2.M_dY);
}
int main()
{
Point P1(6.0,7.1), P2(5.0,6.0); //Change the value of argument however you like
if(P1>P2)
cout<<"P1>P2=True";
else
cout<<"P1>P2=False";
return(0);
}
How to add html / java script on blogger
1. Log into your Blogger account.
2. Once logged in you will need to click on "Layout"
3. Next you will need to decide where you would like to run Chitika ads on your Blogger site.
4. When you have the desired location you will need to click on "Add a Gadget"
5. You will then need to click on HTML/JavaScript to add JavaScript code to your site.
6. This will bring up a new window that you can copy and paste the ad code you have generated from the publisher panel into the "Content section." Once you have the code in this window you will need to click save.
7. Next you will need to click "Save Arrangement" and you are done.
Enjoy!!!!!!!!!!!!!!!!!!
How to create a Blog with Blogger
You must have gmail account for creating a blog with blogger. Don't have a gmail account ? create NOW
After creating Gmail account go to Blogger.com
Enter your gmail ID and password on required field. eg.
and click on sign in button.
Now click on 'New Blog' and choose title of your blog and address of your blog.
choose a template and click on 'create blog!'.
Now your blog has been successfully created. Enjoy!!!!!
Wednesday, March 19, 2014
Overloading Logical Operator "<="
//Overloading Logical Operator "<="
#include<iostream.h>
class Point
{
private:
double M_dX, M_dY;
public:
Point(double dX=0.0, double dY=0.0)
{
M_dX=dX;
M_dY=dY;
}
friend bool operator<=(Point &P1, Point &P2);
};
bool operator<=(Point &P1, Point &P2)
{
return(P1.M_dX<=P2.M_dX && P1.M_dY<=P2.M_dY);
}
int main()
{
Point P1(6.0,7.1), P2(7.0,7.1); //Change the value of argument however you like
if(P1<=P2)
cout<<"P1<=P2=True";
else
cout<<"P1<=P2=False";
return(0);
}
#include<iostream.h>
class Point
{
private:
double M_dX, M_dY;
public:
Point(double dX=0.0, double dY=0.0)
{
M_dX=dX;
M_dY=dY;
}
friend bool operator<=(Point &P1, Point &P2);
};
bool operator<=(Point &P1, Point &P2)
{
return(P1.M_dX<=P2.M_dX && P1.M_dY<=P2.M_dY);
}
int main()
{
Point P1(6.0,7.1), P2(7.0,7.1); //Change the value of argument however you like
if(P1<=P2)
cout<<"P1<=P2=True";
else
cout<<"P1<=P2=False";
return(0);
}
Overloading Logical equal Operator
//Overloading Logical Operator "==" & "!="
#include<iostream.h>
class Point
{
private:
double M_dX, M_dY;
public:
Point(double dX=0.0, double dY=0.0)
{
M_dX=dX;
M_dY=dY;
}
friend bool operator==(Point &P1, Point &P2);
friend bool operator!=(Point &P1, Point &P2);
};
bool operator==(Point &P1, Point &P2)
{
return(P1.M_dX==P2.M_dX && P1.M_dY==P2.M_dY);
}
bool operator!=(Point &P1, Point &P2)
{
return!(P1==P2);
}
int main()
{
Point P1(4.55,6.0), P2(4.55,6.0);
if(P1==P2)
cout<<"P1==P2=True";
else
cout<<"P1==P2=False";
return(0);
}
#include<iostream.h>
class Point
{
private:
double M_dX, M_dY;
public:
Point(double dX=0.0, double dY=0.0)
{
M_dX=dX;
M_dY=dY;
}
friend bool operator==(Point &P1, Point &P2);
friend bool operator!=(Point &P1, Point &P2);
};
bool operator==(Point &P1, Point &P2)
{
return(P1.M_dX==P2.M_dX && P1.M_dY==P2.M_dY);
}
bool operator!=(Point &P1, Point &P2)
{
return!(P1==P2);
}
int main()
{
Point P1(4.55,6.0), P2(4.55,6.0);
if(P1==P2)
cout<<"P1==P2=True";
else
cout<<"P1==P2=False";
return(0);
}
Tuesday, March 18, 2014
simple example to record student info in C++
#include<iostream.h>
class student
{
char name[50],add[60];
int roll,grade;
public:
void getdata()
{
cout<<"Enter your name : ";
cin>>name;
cout<<"\nEnter your Roll no : ";
cin>>roll;
cout<<"\nEnter your Class : ";
cin>>grade;
cout<<"Enter your address : ";
cin>>add;
}
void display()
{
cout<<"\nname : "<<name;
cout<<"\nRoll no : "<<roll;
cout<<"\nAddress : "<<add;
cout<<"\nClass : "<<grade;
}
}s[10];
int main()
{
int i;
for(i=0;i<2;i++)
s[i].getdata();
for(i=0;i<2;i++)
{s[i].display();
}
return 0;
}
Read More »
class student
{
char name[50],add[60];
int roll,grade;
public:
void getdata()
{
cout<<"Enter your name : ";
cin>>name;
cout<<"\nEnter your Roll no : ";
cin>>roll;
cout<<"\nEnter your Class : ";
cin>>grade;
cout<<"Enter your address : ";
cin>>add;
}
void display()
{
cout<<"\nname : "<<name;
cout<<"\nRoll no : "<<roll;
cout<<"\nAddress : "<<add;
cout<<"\nClass : "<<grade;
}
}s[10];
int main()
{
int i;
for(i=0;i<2;i++)
s[i].getdata();
for(i=0;i<2;i++)
{s[i].display();
}
return 0;
}
Overloading Logical Operator ">="
//Overloading Logical Operator ">="
#include<iostream.h>
class Point
{
private:
double M_dX, M_dY;
public:
Point(double dX=0.0, double dY=0.0)
{
M_dX=dX;
M_dY=dY;
}
friend bool operator>=(Point &P1, Point &P2);
};
bool operator>=(Point &P1, Point &P2)
{
return(P1.M_dX>=P2.M_dX && P1.M_dY>=P2.M_dY);
}
int main()
{
Point P1(6.0,7.1), P2(6.0,5.4); //Change the value of argument however you like
if(P1>=P2)
cout<<"P1>=P2=True";
else
cout<<"P1>=P2=False";
return(0);
}
#include<iostream.h>
class Point
{
private:
double M_dX, M_dY;
public:
Point(double dX=0.0, double dY=0.0)
{
M_dX=dX;
M_dY=dY;
}
friend bool operator>=(Point &P1, Point &P2);
};
bool operator>=(Point &P1, Point &P2)
{
return(P1.M_dX>=P2.M_dX && P1.M_dY>=P2.M_dY);
}
int main()
{
Point P1(6.0,7.1), P2(6.0,5.4); //Change the value of argument however you like
if(P1>=P2)
cout<<"P1>=P2=True";
else
cout<<"P1>=P2=False";
return(0);
}
Saturday, March 15, 2014
How to install jar files on android device
.jpg)
- What is JBED?
- How to use jar programs with JBED ?
- Download JBED from here.
- Download 'jbedvm.so' from here and place it in 'system\lib' folder.
- Install JBED but donot run it.
- Restart the phone then Launch JBED application.
- Press menu button and choose SD card.
- Select your .JAR/.JAD file that you want to install and run.
- Now install the chosen application through JBED.
- Now open the installed java application to run. .
Now you are done !!! You can use your favorite jar files on your android.
Earn with Probux
Probux is a PTC(Pay To Click) site. which pays you money, if you visit other sites through it. And it also provide the quality traffic to your site if you have become a advertiser, paying certain amount of money.
- How can we earn money with probux?
- viewing ads:-There is a four(4) fixed ads, from where you can easily earn $0.01 per each ad(means $0.04 per day).there are many more other ads, which pays you upto $0.005 per each ad.
- Progrid:-It is kind of a lucky game. There are twenty(20) chances per day. You can win upto $5(But this is in a rare case).
- Direct Referrals:-You can earn by referring your friend and others to signup and click ads in a probux. You both can earn from this method.
- Rented referrals:-This is a great feature of Probux. You can rent your account to others. If you have rental referrals you can earn upto 50% of their earning doing nothing or you can make upto $2 per day.
- Crowd flowers:- crowd flowers is a company, which undertakes the different projects and tasks and place them onto probux.Every projects will have a different payout rates. If you earned $50 you will be crowned by $5.
You can double your income by upgrading your membership to premium account.
- Payment processes:
there are two processes Paypal and Payza.
Wednesday, March 12, 2014
swap numbers by using call by reference in C++
#include<iostream.h>
int swap(int &a, int &b)
{
int t=a;
a=b;
b=t;
}
int main()
{
int x=5; int y=67;
cout<<"Before swap : "<<x<<"\t"<<y<<"\n";
swap(x,y);
cout<<"\nAfter Swap: "<<x<<"\t"<<y<<"\n";
return 0;
}
Read More »
int swap(int &a, int &b)
{
int t=a;
a=b;
b=t;
}
int main()
{
int x=5; int y=67;
cout<<"Before swap : "<<x<<"\t"<<y<<"\n";
swap(x,y);
cout<<"\nAfter Swap: "<<x<<"\t"<<y<<"\n";
return 0;
}
swap numbers in C++
#include<iostream.h>
#include<conio.h>
int main()
{
int a,b,t;
cout<<"Enter First Number : ";
cin>>a;
cout<<"\nEnter Second Number : ";
cin>>b;
cout<<"Before Swaping : "<<a<<"\t"<<b;
t=a;
a=b;
b=t;
cout<<"\n After Swaping : "<<a<<"\t"<<b;
getch();
}
Read More »
#include<conio.h>
int main()
{
int a,b,t;
cout<<"Enter First Number : ";
cin>>a;
cout<<"\nEnter Second Number : ";
cin>>b;
cout<<"Before Swaping : "<<a<<"\t"<<b;
t=a;
a=b;
b=t;
cout<<"\n After Swaping : "<<a<<"\t"<<b;
getch();
}
Tuesday, March 11, 2014
C program to implement Queue using Function
#include<stdio.h>
#include<windows.h>
#include<conio.h>
#define SIZE 5
int insert();
int deletedata();
int display();
struct Queue
{
int queue[SIZE];
int front, rear;
}s;
int main()
{
s.front=0;
s.rear=0;
int ch;
while(1)
{
printf("\n1.Insert Data\n2.Delete Data\n3.Display Data\n4.Exit\n\t");
printf("Enter your choice : ");
scanf("%d", &ch);
switch(ch)
{
case 1:
insert();
break;
case 2:
deletedata();
break;
case 3:
display();
break;
case 4:
system("exit");
break;
default:
printf("Invalid Choice ");
}
}
getch();
}
int insert()
{
int n;
if(s.front==(SIZE-1))
printf("Queue Is full");
else
{
printf("Enter the element : ");
scanf("%d",&n);
s.queue[s.rear]=n;
s.rear++;
}
}
int deletedata()
{
int n;
if(s.front==s.rear)
printf("The Queue is Empty ");
else
{
printf("Enter the element to be deleted ");
scanf("%d", &n);
n=s.queue[s.front];
printf("Deleted Element is %d",s.queue[s.front]);
s.front++;
}
}
int display()
{int i;
if(s.front==s.rear)
printf("The queue is Empty");
else
{
printf("The elements of Queue are : ");
for(i=s.front;i<s.rear;i++)
printf("%d",s.queue[i]);
}
}
Read More »
#include<windows.h>
#include<conio.h>
#define SIZE 5
int insert();
int deletedata();
int display();
struct Queue
{
int queue[SIZE];
int front, rear;
}s;
int main()
{
s.front=0;
s.rear=0;
int ch;
while(1)
{
printf("\n1.Insert Data\n2.Delete Data\n3.Display Data\n4.Exit\n\t");
printf("Enter your choice : ");
scanf("%d", &ch);
switch(ch)
{
case 1:
insert();
break;
case 2:
deletedata();
break;
case 3:
display();
break;
case 4:
system("exit");
break;
default:
printf("Invalid Choice ");
}
}
getch();
}
int insert()
{
int n;
if(s.front==(SIZE-1))
printf("Queue Is full");
else
{
printf("Enter the element : ");
scanf("%d",&n);
s.queue[s.rear]=n;
s.rear++;
}
}
int deletedata()
{
int n;
if(s.front==s.rear)
printf("The Queue is Empty ");
else
{
printf("Enter the element to be deleted ");
scanf("%d", &n);
n=s.queue[s.front];
printf("Deleted Element is %d",s.queue[s.front]);
s.front++;
}
}
int display()
{int i;
if(s.front==s.rear)
printf("The queue is Empty");
else
{
printf("The elements of Queue are : ");
for(i=s.front;i<s.rear;i++)
printf("%d",s.queue[i]);
}
}
Monday, March 10, 2014
Simple Example Program Of Copy Constructor Overloading In C++
//Program For Simple Example Program Of Copy Constructor Overloading In C++
#include<iostream>
#include<conio.h>
using namespace std;
class Code {
// Variable Declaration
int a,b;
public:
//Constructor with Argument
Code(int x,int y) {
// Assign Values In Constructor
a=x;
b=y;
cout<<"\nCopy Constructor";
}
void Display() {
cout<<"\nValues :"<<a<<"\t"<<b;
}
};
int main() {
Code Object(10,20);
//Copy Constructor
Code Object2=Object;
// Constructor invoked.
Object.Display();
Object2.Display();
getch();
}
#include<iostream>
#include<conio.h>
using namespace std;
class Code {
// Variable Declaration
int a,b;
public:
//Constructor with Argument
Code(int x,int y) {
// Assign Values In Constructor
a=x;
b=y;
cout<<"\nCopy Constructor";
}
void Display() {
cout<<"\nValues :"<<a<<"\t"<<b;
}
};
int main() {
Code Object(10,20);
//Copy Constructor
Code Object2=Object;
// Constructor invoked.
Object.Display();
Object2.Display();
getch();
}
Sunday, March 9, 2014
class example in C++
#include <iostream.h>
class Person
{
char name[50];
int age;
public: // makes member function public, so that which can be accessibled.
int getdata()
{
cout<<"Enter Your Name : ";
cin>>name;
cout<<"Enter Your Age : ";
cin>>age;
}
int display()
{
cout<<"Your Name is : "<<name<<"\n";
cout<<"And Your age is : "<<age<<"\n";
}
};//End of class.
int main()
{
Person p;//variable of class declared.
p.getdata();
p.display();
return 0;
}
Read More »
class Person
{
char name[50];
int age;
public: // makes member function public, so that which can be accessibled.
int getdata()
{
cout<<"Enter Your Name : ";
cin>>name;
cout<<"Enter Your Age : ";
cin>>age;
}
int display()
{
cout<<"Your Name is : "<<name<<"\n";
cout<<"And Your age is : "<<age<<"\n";
}
};//End of class.
int main()
{
Person p;//variable of class declared.
p.getdata();
p.display();
return 0;
}
Friday, March 7, 2014
C program to implement Stack operation
#include<stdio.h>
#include<windows.h>
#define MAXSIZE 5
struct stack
{
int stk[MAXSIZE];
int top;
}s;
void push();
int pop();
int display();
int main ()
{
int choice;
char a;
s.top =0;
printf ("\t\tSTACK OPERATION\n");
while (1)
{
printf ("\n");
printf (" 1.PUSH\n");
printf (" 2.POP\n");
printf (" 3.DISPLAY\n");
printf (" 4.EXIT\n");
printf ("------------------------------------------\n");
printf("Enter your choice : ");
scanf("%d", &choice);
switch (choice)
{
case 1:
push();
break;
case 2:
pop();
break;
case 3:
display();
break;
case 4:
exit(0);
break;
default:
printf("Invalid Option");
}
}
}
void push ()
{
int num;
if (s.top==(MAXSIZE - 1))
{
printf ("Stack is Full\n");
}
else
{
printf ("Enter the element to be pushed : ");
scanf ("%d", &num);
s.top = s.top + 1;
s.stk[s.top] = num;
}
return;
}
int pop ()
{
int num;
if (s.top==0)
{
printf ("Stack is Empty\n");
}
else
{
printf("Enter the element to be popped : ");
scanf("%d", &num);
num = s.stk[s.top];
printf ("poped element is = %d", s.stk[s.top]);
s.top=s.top-1;
}
}
int display ()
{
int i;
if (s.top==0)
{
printf("Stack is empty\n");
}
else
{
printf ("\n The status of the stack is : ");
for (i=1;i<=s.top;i++)
{
printf ("%d ", s.stk[i]);
}
}
}
Read More »
#include<windows.h>
#define MAXSIZE 5
struct stack
{
int stk[MAXSIZE];
int top;
}s;
void push();
int pop();
int display();
int main ()
{
int choice;
char a;
s.top =0;
printf ("\t\tSTACK OPERATION\n");
while (1)
{
printf ("\n");
printf (" 1.PUSH\n");
printf (" 2.POP\n");
printf (" 3.DISPLAY\n");
printf (" 4.EXIT\n");
printf ("------------------------------------------\n");
printf("Enter your choice : ");
scanf("%d", &choice);
switch (choice)
{
case 1:
push();
break;
case 2:
pop();
break;
case 3:
display();
break;
case 4:
exit(0);
break;
default:
printf("Invalid Option");
}
}
}
void push ()
{
int num;
if (s.top==(MAXSIZE - 1))
{
printf ("Stack is Full\n");
}
else
{
printf ("Enter the element to be pushed : ");
scanf ("%d", &num);
s.top = s.top + 1;
s.stk[s.top] = num;
}
return;
}
int pop ()
{
int num;
if (s.top==0)
{
printf ("Stack is Empty\n");
}
else
{
printf("Enter the element to be popped : ");
scanf("%d", &num);
num = s.stk[s.top];
printf ("poped element is = %d", s.stk[s.top]);
s.top=s.top-1;
}
}
int display ()
{
int i;
if (s.top==0)
{
printf("Stack is empty\n");
}
else
{
printf ("\n The status of the stack is : ");
for (i=1;i<=s.top;i++)
{
printf ("%d ", s.stk[i]);
}
}
}
Monday, March 3, 2014
Sum or Addition in C++
#include <iostream>
using namespace std;
int main()
{
int a, b, c;
cout << "Enter two numbers to add\n";
cin >> a >> b;
c = a + b;
cout <<"Sum of entered numbers is = " << c << endl;
return 0;
}
Hello world program in C++
#include<iostream>
using namespace std;
int main()
{
cout << "Hello World\n";
return 0;
}
C Program to check whether anagrams or not
#include <stdio.h>
int check_anagram(char [], char []);
int main()
{
char a[100], b[100];
int flag;
printf("Enter first string\n");
gets(a);
printf("Enter second string\n");
gets(b);
flag = check_anagram(a, b);
if (flag == 1)
printf("\"%s\" and \"%s\" are anagrams.\n", a, b);
else
printf("\"%s\" and \"%s\" are not anagrams.\n", a, b);
return 0;
}
int check_anagram(char a[], char b[])
{
int first[26] = {0}, second[26] = {0}, c = 0;
while (a[c] != '\0')
{
first[a[c]-'a']++;
c++;
}
c = 0;
while (b[c] != '\0')
{
second[b[c]-'a']++;
c++;
}
for (c = 0; c < 26; c++)
{
if (first[c] != second[c])
return 0;
}
return 1;
}
Read More »
int check_anagram(char [], char []);
int main()
{
char a[100], b[100];
int flag;
printf("Enter first string\n");
gets(a);
printf("Enter second string\n");
gets(b);
flag = check_anagram(a, b);
if (flag == 1)
printf("\"%s\" and \"%s\" are anagrams.\n", a, b);
else
printf("\"%s\" and \"%s\" are not anagrams.\n", a, b);
return 0;
}
int check_anagram(char a[], char b[])
{
int first[26] = {0}, second[26] = {0}, c = 0;
while (a[c] != '\0')
{
first[a[c]-'a']++;
c++;
}
c = 0;
while (b[c] != '\0')
{
second[b[c]-'a']++;
c++;
}
for (c = 0; c < 26; c++)
{
if (first[c] != second[c])
return 0;
}
return 1;
}
C Program to generate Armstrong Numbers
#include <stdio.h>
int main()
{
int r;
long number = 0, c, sum = 0, temp;
printf("Enter an integer upto which you want to find armstrong numbers\n");
scanf("%ld",&number);
printf("Following armstrong numbers are found from 1 to %ld\n",number);
for( c = 1 ; c <= number ; c++ )
{
temp = c;
while( temp != 0 )
{
r = temp%10;
sum = sum + r*r*r;
temp = temp/10;
}
if ( c == sum )
printf("%ld\n", c);
sum = 0;
}
return 0;
}
C program to print Floyd's triangle
#include <stdio.h>
int main()
{
int n, i, c, a = 1;
printf("Enter the number of rows of Floyd's triangle to print\n");
scanf("%d", &n);
for (i = 1; i <= n; i++)
{
for (c = 1; c <= i; c++)
{
printf("%d ",a);
a++;
}
printf("\n");
}
return 0;
}
Read More »
int main()
{
int n, i, c, a = 1;
printf("Enter the number of rows of Floyd's triangle to print\n");
scanf("%d", &n);
for (i = 1; i <= n; i++)
{
for (c = 1; c <= i; c++)
{
printf("%d ",a);
a++;
}
printf("\n");
}
return 0;
}
Multiply Two matrix from C
#include <stdio.h>
int main()
{
int m, n, p, q, c, d, k, sum = 0;
int first[10][10], second[10][10], multiply[10][10];
printf("Enter the number of rows and columns of first matrix\n");
scanf("%d%d", &m, &n);
printf("Enter the elements of first matrix\n");
for ( c = 0 ; c < m ; c++ )
for ( d = 0 ; d < n ; d++ )
scanf("%d", &first[c][d]);
printf("Enter the number of rows and columns of second matrix\n");
scanf("%d%d", &p, &q);
if ( n != p )
printf("Matrices with entered orders can't be multiplied with each other.\n");
else
{
printf("Enter the elements of second matrix\n");
for ( c = 0 ; c < p ; c++ )
for ( d = 0 ; d < q ; d++ )
scanf("%d", &second[c][d]);
for ( c = 0 ; c < m ; c++ )
{
for ( d = 0 ; d < q ; d++ )
{
for ( k = 0 ; k < p ; k++ )
{
sum = sum + first[c][k]*second[k][d];
}
multiply[c][d] = sum;
sum = 0;
}
}
printf("Product of entered matrices:-\n");
for ( c = 0 ; c < m ; c++ )
{
for ( d = 0 ; d < q ; d++ )
printf("%d\t", multiply[c][d]);
printf("\n");
}
}
return 0;
}
Read More »
int main()
{
int m, n, p, q, c, d, k, sum = 0;
int first[10][10], second[10][10], multiply[10][10];
printf("Enter the number of rows and columns of first matrix\n");
scanf("%d%d", &m, &n);
printf("Enter the elements of first matrix\n");
for ( c = 0 ; c < m ; c++ )
for ( d = 0 ; d < n ; d++ )
scanf("%d", &first[c][d]);
printf("Enter the number of rows and columns of second matrix\n");
scanf("%d%d", &p, &q);
if ( n != p )
printf("Matrices with entered orders can't be multiplied with each other.\n");
else
{
printf("Enter the elements of second matrix\n");
for ( c = 0 ; c < p ; c++ )
for ( d = 0 ; d < q ; d++ )
scanf("%d", &second[c][d]);
for ( c = 0 ; c < m ; c++ )
{
for ( d = 0 ; d < q ; d++ )
{
for ( k = 0 ; k < p ; k++ )
{
sum = sum + first[c][k]*second[k][d];
}
multiply[c][d] = sum;
sum = 0;
}
}
printf("Product of entered matrices:-\n");
for ( c = 0 ; c < m ; c++ )
{
for ( d = 0 ; d < q ; d++ )
printf("%d\t", multiply[c][d]);
printf("\n");
}
}
return 0;
}
Subscribe to:
Posts (Atom)