This blog is very useful for those persons who want to Learn programming / Enhance programming skills

Stay here to get alots of stuffs


Sunday 24 January 2016

// // Leave a Comment

Sum Using Function

C++ program Sum the Three Integers Using function

Function:

Functions are self contained modules of  code  that accomplished a specific task. function usually take data , process it and return a result.


code:

#include<iostream>
using namespace std;
int main()
{
void sum(int, int, int);
int number1, number2, number3;
cout << "This Program Calcuates sum of three number:" << "\n";
cout << "Enter 1st number:";
cin >> number1;
cout << "Enter 2nd number:";
cin >> number2;
cout << "Enter 3rd number:";
cin >> number3;
sum(number1, number2, number3);
system("pause");
}
void sum(int number1, int number2, int number3)
{
int sum = 0;
sum = number1 + number2 + number3;
cout << "Sum of three number is:"  << sum;
}

*------------------------------------------------------------------------------------------------------*

#include hum is liya likhta hain taka hum ak header file ko samil kar saka. jasa ke "iostream" is program ma samil kia. header files ko is liya hum istimal karta hai q ka us ma pahla sa he kuch functions ko store karwa lia jata hai. Taka baad ma humay bar bar usay likhna na paray bs us ke header file ko shamil kar ka us function ko call kar lia jae .
iostream ma b kuch function ko store karwaya gaya hai FOR EXAMPLE

cout :Standard output stream=>cout hum kuch be screen pa print karwana ka lia istemal karta hai

cin:Standard input stream=>cin hum user sa kuch b value enter karwana ka lia istimal karta hai

cerr:Standard output stream for errors =>c error screen pa error massege show karwana ka lia

clog:Standard output stream for logging=ya logging ka lia istimal hota hai.agar aur information lani ho tu is link ko click karay

http://www.cplusplus.com/reference/iostream/clog/




Read More
// // Leave a Comment

PROFIT AND LOSS

C++ Program Calculate the Loss and Profit of Seller




#include<iostream>
using namespace std;

int main()
{
int costprice, sellprice, result;
cout<<"Please enter the cost price: \n";
cin >> costprice;
cout<<"Please enter the selling price: \n";
cin >> sellprice;
if (costprice>sellprice)
{
result = costprice - sellprice;
cout<<"\nSeller Loss of  rupees: " <<result;
}
if (costprice<sellprice)
{
result = sellprice - costprice;
cout << "\nSeller Profit of  rupees: " << result;
}
system("pause");
}




*------------------------------------------------------------------------------------------------------*

#include hum is liya likhta hain taka hum ak header file ko samil kar saka. jasa ke "iostream" is program ma samil kia. header files ko is liya hum istimal karta hai q ka us ma pahla sa he kuch functions ko store karwa lia jata hai. Taka baad ma humay bar bar usay likhna na paray bs us ke header file ko shamil kar ka us function ko call kar lia jae .
iostream ma b kuch function ko store karwaya gaya hai FOR EXAMPLE

cout :Standard output stream=>cout hum kuch be screen pa print karwana ka lia istemal karta hai

cin:Standard input stream=>cin hum user sa kuch b value enter karwana ka lia istimal karta hai

cerr:Standard output stream for errors =>c error screen pa error massege show karwana ka lia

clog:Standard output stream for logging=ya logging ka lia istimal hota hai.agar aur information lani ho tu is link ko click karayhttp://www.cplusplus.com/reference/iostream/clog/



Read More

Friday 22 January 2016

// // Leave a Comment

C++ Maximum Using Function

C++ Program Show Maximum Number By Using Function

Function:

Functions are self contained modules of  code  that accomplished a specific task. function usually take data , process it and return a result.

Object oriented programming:

Object Orientation is a technique for system modeling. Object Oriented Model consists of several interacting objects. An object is: Something tangible, e.g. Ali, Car, House, Tree. Something that can be apprehended intellectually, e.g. Time, Date. An object has a state also known as attribute, well defined behaviour or operations and a unique identity.

code:



#include<iostream>
using namespace std;
void main()
{
void maximum(int, int);
int number1, number2;
cout << "Enter 1st Number:";
cin >> number1;
cout << "Enter 2nd Number:";
cin >> number2;
maximum(number1, number2);
system("pause");
}
void maximum(int n1, int n2)
{
if (n1 > n2)
cout << "Maximum Number is\n" << n1;
else
cout << "Maximum Number is\n" << n2;
}



Read More
// // Leave a Comment

C++TABLE WITH RANGE

C++ Program that Determines the Multiplication Table with Range






#include<iostream>
using namespace std;
int main()
{
int table,range;
cout << "Plaese Enter the Number : \n";
cin >> table;
cout << "Please Enter the Range of the Table : \n";
cin >> range;
for (int x = 1; x <= range; x++)
{

cout << table << "x" << x << "=" << table*x << endl;
}
system("pause");
}




Read More
// // Leave a Comment

C++ TABLE

C++ program To Generate Multiplication Table





#include<iostream>
using namespace std;
int main()
{
int table;
cout << "Plaese Enter the Number : \n";
cin >> table;
for (int x = 1; x <= 20; x++)
{

cout << table << "x" << x << "=" << table*x << endl;
}
system("pause");
}


*------------------------------------------------------------------------------------------------------*

#include hum is liya likhta hain taka hum ak header file ko samil kar saka. jasa ke "iostream" is program ma samil kia. header files ko is liya hum istimal karta hai q ka us ma pahla sa he kuch functions ko store karwa lia jata hai. Taka baad ma humay bar bar usay likhna na paray bs us ke header file ko shamil kar ka us function ko call kar lia jae .
iostream ma b kuch function ko store karwaya gaya hai FOR EXAMPLE

cout :Standard output stream=>cout hum kuch be screen pa print karwana ka lia istemal karta hai

cin:Standard input stream=>cin hum user sa kuch b value enter karwana ka lia istimal karta hai

cerr:Standard output stream for errors =>c error screen pa error massege show karwana ka lia

clog:Standard output stream for logging=ya logging ka lia istimal hota hai.agar aur information lani ho tu is link ko click karayhttp://www.cplusplus.com/reference/iostream/clog/






Read More

Thursday 21 January 2016

// // Leave a Comment

EVEN AND ODD

C++ Program for Checking Number Is Even or Odd

#include<iostream>
using namespace std;
int main() 
{
int number;
cout<<"Please enter the number: \n";
cin>>number;
if (number % 2 == 0)
cout<<"\nThe number is EVEN.\n";
else
cout<<"\nThe number is ODD.\n";
system("pause");
}





Read More

Wednesday 20 January 2016

// // Leave a Comment

LEAP YEAR

C++ Program For Checking Leap Year Or Not

#include<iostream>
#include<stdlib.h>
using namespace std;
void main()
{
unsigned year;
cout << "Enter any year for check wheather its leap year or not:";
cin >> year;
if (year % 4 == 0)
cout << "Its a leap year"<<endl;
else
cout << "Its not a leap year"<<endl;
cout<<"-------------------------------------------------------------";
cout << "If you want to check again press 1 !\n";
int again;
cin >> again;
       
if (again == 1)
{
{
system("CLS");
main();
}
}
else
{
cout << "THANK YOU ^ - ^\n";
}
system("pause");
}



Read More