Programming with M.Khan

Programming with M.Khan C++ is a programming language that was developed by Bjarne Stroustrup in 1983.

Pros:

It is a popular language, and thus, there are many compilers and libraries
Other programming languages like C, C #

28/05/2023
28/02/2023

Object-Oriented Programming

C++ fully supports object-oriented programming, including the four pillars of object-oriented development:
- Encapsulation
- Data hiding
- Inheritance
- Polymorphism

28/02/2023

Two Numbers Addition

using namespace std;

int main()
{
int first, second, sum;

coutfirst>>second;

sum = first + second ;
/*Adding contents of first and second and storing in sum*/

cout

01/02/2023



using namespace std;

double divisionby(int num1, int num2)
{
if (num2 == 0)
{
throw "Division by zero condition!";
}
cout n1 >> n2;
double n3 = 0;

//try catch to handle run time error
try
{
n3 = divisionby(n1, n2);
cout

01/02/2023

//Highest Marks in Subjects




using namespace std;

class Student
{
int maximum;
char subject[30];

public:
void get_data()
{
int size,i;

coutsize;

char names[size][30];

cout

01/02/2023

# include
using namespace std;
int main()
{
char operation;
float num1,num2;
cout > operation;
cout > num1 >> num2;
switch(operation) {
case '+':
cout

01/02/2023

// Display the current date in the formats of "2007-11-10"
// and "Sunday, November 10, 2007".






class Date
{
struct tm ltime;

public:

/// Default constructor.
Date()
{
time_t t = time(0);
localtime_r(&t, <ime);
}

std::string getDate(const char* fmt)
{
char out[200];
size_t result = strftime(out, sizeof out, fmt, <ime);
return std::string(out, out + result);
}

std::string getISODate() {return getDate("%F");}

std::string getTextDate() {return getDate("%A, %B %d, %Y");}
};

int main()
{
Date d;
std::cout

01/02/2023

//program to show how call by value works


using namespace std;

//function definition
void swap(int x, int y)
{
int z;
z = x;
x = y;
y = z;
cout

Address

Alipur
Islamabad
34450

Alerts

Be the first to know and let us send you an email when Programming with M.Khan posts news and promotions. Your email address will not be used for any other purpose, and you can unsubscribe at any time.

Contact The Business

Send a message to Programming with M.Khan:

Share