Friday, March 28, 2014

Simple C++ program to find circumference and diameter of circle

#include<iostream.h>
#include<conio.h>
int main()
{
clrscr();
int diameter,r;
cout<<"Enter radius of circle:"; //prompt
cin>>r;//input
cout<<"Diameter is:"<<r*2<<endl;
cout<<"Circumference is:"<<2*3.14159*r<<endl;
getch();
return 0;
}

Simple C++ program to add two numbers

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c;
cout<<"Enter the numbers to add"<<endl;
cin>>a>>b;
c=a+b;
cout<<"Addition of "<<a<<" and "<<b<<" is="<<c<<endl;
getch();
}

C++ Program to swap numbers using class

#include<iostream.h>
#include<conio.h>
class swap       //Class name
{
int a,b;
public:
void getdata();    //Declaration
void swapv();
void display();
};
void swap::getdata()          //Member function definition
{
cout<<"Enter two numbers:";
cin>>a>>b;
}
void swap::swapv()
{
 a=a+b;
 b=a-b;
 a=a-b;
 }
 void swap::display()
 {
 cout<<"\na="<<a<<"\nb="<<b;
 }
 main()                        //Main program
 {
 clrscr();
 swap s;
 s.getdata();                  //Accessing getdta and display
 cout<<"\nBefore swap:";
 s.display();
 s.swapv();
 cout<<"\nAfter swap:";
 s.display();
 getch();
 return 0;
 }

C++ program to find smallest,largest,product and average using class

#include<iostream.h>
#include<conio.h>
int main()
{
clrscr();
int num1,num2,num3,smallest,largest; //declaration
cout<<"Input three integers:";//prompt
cin>>num1>>num2>>num3;//input
largest=num1; //assume first number is largest
if(num2>largest)//is num2 larger?
largest=num2; //assume second number is larger
if(num3>largest)//is num3 largest?
largest=num3; //assume num3 is larger
smallest=num1; //assume num1 is smallest
if(num2<smallest)
smallest=num2;
if(num3<smallest)
smallest=num3;
cout<<"Sum is:\n"<<num1+num2+num3<<endl;
cout<<"Average is:\n"<<(num1+num2+num3)/3<<endl;
cout<<"\nProduct is:\n"<<num1*num2*num3<<"\nSmallest is:\n"<<smallest<<"\nLargestis:\n"<<largest<<endl;
getch();
return 0;
}

C++ Program to find largest number using class

#include<iostream.h>
#include<conio.h>
class set
{
int m,n;
public:
 int largest();
 void input(void);
 void display();
};
int set::largest()
{
if(m>=n)
return(m);
else
return(n);
}
void set::input(void)
{
cout<<"Input the values of m and n:"<<m<<n<<endl;
cin>>m>>n;
}
void set::display()
{
cout<<"largest number is:"<<largest();
}
int main()
{
clrscr();
set A;
A.input();
A.display();
getch();
return 0;
}

Thursday, February 6, 2014

Easily Get Payoneer Master Card in Pakistan


Payoneer is a payout company founded in 2005. Payoneer is a registered Member Service Provider (MSP) of Master Card. The Company is headquartered in  New York USA.

Important Features

  • Transfer funds to Prepaid Debit Master cards
  • Send bank transfers to more than 200 countries
  • Get started with a quick, simple and secure integration. 
  • Receive funds from U.S. based companies
  • Withdraw funds to your local bank account.
  • Spend funds with a Prepaid Debit MasterCard® card.

How to apply for free delievery in Pakistan

  • Click here to visit Payoneer website www.payoneer.com.
  • Fill the form by providing your correct address so that you can receive you master card.
  • You will receive your Payoneer Master Card within 20 or 30 days based on your location.

 

Tuesday, February 4, 2014

C Program to calculate points based on Grade using the Switch statement

#inlcude<stdio.h>
int main()
{
  char grade;
  int points;
printf("\nEnter a grade(A-F):");
scanf("%c",&grade);
 switch(grade)
{
case 'A':
          points=5;
          printf("\nThe grade is A.");
         break;
case 'B':
     points=4;
     printf("\nThe grade is B.");
     break;
case 'C':
points=3;
     printf("\nThe grade is C.");
     break;
case 'D':
points=2;
     printf("\nThe grade is D.");
     break;
case 'E':
points=1;
     printf("\nThe grade is E.");
     break;
case 'F':
points=0;
     printf("\nThe grade is invalid.");
     break;
}
if(points>0)
 printf("\nPassed ,points earned=%d\n",points);
else
  printf("\nFailed ,no points earned\n");
return 0;
}