From 8d98343dc44a7ede4097cc79d4ef576afe95ee3a Mon Sep 17 00:00:00 2001
From: Piyali31 <115275476+Piyali31@users.noreply.github.com>
Date: Fri, 7 Oct 2022 21:55:41 +0530
Subject: [PATCH 1/5] Square Sum Array Using C

---
 Square_Sum_Array.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 Square_Sum_Array.c

diff --git a/Square_Sum_Array.c b/Square_Sum_Array.c
new file mode 100644
index 00000000..9e1d8b04
--- /dev/null
+++ b/Square_Sum_Array.c
@@ -0,0 +1,28 @@
+/* Take input the elements of an array. find the sum of their squares. */
+#include<stdio.h>
+int main()
+{
+    int arr[5],sum=0,val;
+    // Take inputs of an array
+    printf("Enter Elements: ");
+    for(int i=0;i<5;i++)
+        scanf("%d",&arr[i]);
+    
+    // Calculation
+    for(int i=0;i<5;i++)
+    {
+        sum=sum+(arr[i]*arr[i]);
+    }
+
+    //Printing Result
+    printf("Values\t\tSquare Values");
+    printf("\n");
+    for(int i=0;i<5;i++)
+    {
+        printf("%d\t\t" "%d",arr[i],arr[i]*arr[i]);
+        printf("\n");
+    }
+    printf("The Sum is: %d",sum);
+
+    return 0;
+}
\ No newline at end of file

From c66602dce576cddbc2d9c93fa458ae8f170ee6fb Mon Sep 17 00:00:00 2001
From: Piyali31 <115275476+Piyali31@users.noreply.github.com>
Date: Fri, 7 Oct 2022 22:01:57 +0530
Subject: [PATCH 2/5] Count number of objects in CPP

---
 Count_Number_of_object.cpp | 55 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 Count_Number_of_object.cpp

diff --git a/Count_Number_of_object.cpp b/Count_Number_of_object.cpp
new file mode 100644
index 00000000..847ea7cd
--- /dev/null
+++ b/Count_Number_of_object.cpp
@@ -0,0 +1,55 @@
+//count the number of the objects in this program
+#include<iostream>
+using namespace std;
+
+class myclass
+{
+	private:
+		int a=8,b=9;
+	public:
+	myclass()
+	{
+		a=8;
+		b=9;
+		count++;
+	}
+	
+	myclass(int x,int y)
+	{
+		a=x;
+		b=y;
+		count++;
+	}
+	static int count;
+	void display()
+	{
+		cout<<"\na= "<<a<<"\nb= "<<b<<endl;
+	}
+	static void count1()
+	{
+		cout<<"No of objects= "<<count<<endl;	
+	}	
+};
+
+int myclass::count=0;
+int main()
+{
+	cout<<"\nFor object1--->";
+	myclass s1; //creating object s1 with default constructor
+	s1.display(); //a=8 b=9
+	s1.count1();  //count=0;---> count++;---> count=1
+	
+	cout<<"\nFor object2--->";
+	myclass s2(20,60); //creating object s2 with parameterized constructor
+	s2.display(); // a=20 b=60
+	s2.count1(); //count=1--->count++ ---> count=2
+	
+	cout<<"\nFor object3--->";
+	myclass s3; //creating object s3 with default constructor
+	s3.display(); //a=8 b=9
+	s3.count1(); //count=2--->count++ ---> count=3
+	
+	
+	return 0;
+}
+

From 8895ec38318f509faa7756d9bb075e309ff6efd7 Mon Sep 17 00:00:00 2001
From: Piyali31 <115275476+Piyali31@users.noreply.github.com>
Date: Fri, 7 Oct 2022 22:07:06 +0530
Subject: [PATCH 3/5] object Function argument using CPP

---
 Object_Function_Argument.cpp | 122 +++++++++++++++++++++++++++++++++++
 1 file changed, 122 insertions(+)
 create mode 100644 Object_Function_Argument.cpp

diff --git a/Object_Function_Argument.cpp b/Object_Function_Argument.cpp
new file mode 100644
index 00000000..e1de305d
--- /dev/null
+++ b/Object_Function_Argument.cpp
@@ -0,0 +1,122 @@
+#include<iostream>
+using namespace std;
+
+class myclass
+{
+	private: //Access specifier
+		int num; // num is private here
+	public:
+		//public section
+		void get_data() 
+		{
+			cout<<"\nEnter a number: ";
+			cin>>num;
+		}
+		//set_data 3 times definition with different parameter-->method overloading list
+		void set_data(myclass passob) //copy means value
+		{
+			num=passob.num;
+			/*
+				calling object.num=passob.num
+				ob1.num=ob2.num
+				As passob(formal parameter) = ob2 (actual parameter)
+				
+				for calling object we don't need to write the object 
+				name to access properly within the method.
+			*/
+		}
+		void set_data(int a, myclass &passob) //call by reference
+		{
+			num=passob.num; 
+			/*
+				calling object.num=passob.num
+				ob4.num=ob2.num
+				As passob(formal parameter) = ob2 (actual parameter)
+				
+				for calling object we don't need to write the object 
+				name to access properly within the method.
+			*/
+		}
+		void set_data(myclass *passob) //call by address
+		{
+			num=passob->num;
+			/*
+				calling object.num=passob->num
+				ob3.num=ob2.num
+				As passob(formal parameter) = ob2 (actual parameter)
+				
+				for calling object we don't need to write the object 
+				name to access properly within the method.
+			*/
+		}
+		void show_data()
+		{
+			cout<<"\nNum= "<<num;
+		}
+						
+};
+
+int main()
+{
+	//we are declaring 4 objects of the class myclass
+	myclass ob1,ob2,ob3,ob4;
+	int a=0;
+	ob2.get_data();
+	//ob2.num=user_value
+	
+	ob1.set_data(ob2); //copy means value
+	/*
+	we are trying to set the value of ob1.num by 
+	the value of ob2.num.
+	
+	calling object= ob1
+	passing object= ob2
+	
+	here we are passing an object ob2 within an object method ob1.set_data(..)
+	what is the data type of ob2?
+		it's defiend as myclass ob2;
+		so, data type of ob2 is user defined data 
+		type that is my class.
+	
+	Function calling line
+		function_name(actual_parameter);
+	Funtion definition line
+		return_type funtion_name(data_type formal_parameter);
+		{
+			....
+		}
+	Target of ob1.set_data(ob2);
+		Target is to setup ob1.num=ob2.num
+		
+	-------------------------------------------------
+	
+	for object ob1--->
+	ob1.num
+	ob1.get_data
+	ob1.set_data
+	ob1.set_data
+	ob1.set_data
+	ob1.show_data
+	
+	---------------------------------------------------
+	*/
+	
+	ob3.set_data(&ob2); //address-->we are passing address of ob2
+	ob4.set_data(a,ob2); //reference
+	
+	ob1.show_data();
+	ob2.show_data();
+	ob3.show_data();
+	ob4.show_data();
+	
+	return 0;
+}
+/*
+	int a
+	int is system defined data type
+	
+	myclass myobj;
+	myclass is a user defined data type
+	myobj is an object here
+
+*/

From ee622e4b32b876c1ca944f31d9609df41615d607 Mon Sep 17 00:00:00 2001
From: Piyali31 <115275476+Piyali31@users.noreply.github.com>
Date: Fri, 7 Oct 2022 22:10:20 +0530
Subject: [PATCH 4/5] Complex number Addition using CPP

---
 Complex_No_Addition.cpp | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 Complex_No_Addition.cpp

diff --git a/Complex_No_Addition.cpp b/Complex_No_Addition.cpp
new file mode 100644
index 00000000..6dea1070
--- /dev/null
+++ b/Complex_No_Addition.cpp
@@ -0,0 +1,36 @@
+#include<iostream>
+#include<math.h>
+using namespace std;
+
+class complex
+{
+	public:
+		int real;
+		int img;	
+
+	public:
+		complex()
+		{
+			int real=3;
+			int img=4;
+			cout<<"\nAdd:"<<real<<"+"<<img<<"i";
+		}
+		complex(int a, int b)
+		{
+			real = a;
+			img = b;
+		}
+};
+
+int main()
+{	
+	int real,img;
+	complex c;
+	complex c1(4,5);
+	complex c2(2,3);
+
+	real=c1.real+c2.real;
+	img=c1.img+c2.img;
+	cout<<"\nadd:"<<real<<"+"<<img<<"i";
+return 0;
+}

From 56853addc09d3c968097bf3305b8ef28aad2f087 Mon Sep 17 00:00:00 2001
From: Piyali31 <115275476+Piyali31@users.noreply.github.com>
Date: Fri, 7 Oct 2022 22:12:36 +0530
Subject: [PATCH 5/5] Triange Using CPP

---
 Triangle.cpp | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)
 create mode 100644 Triangle.cpp

diff --git a/Triangle.cpp b/Triangle.cpp
new file mode 100644
index 00000000..0ca24774
--- /dev/null
+++ b/Triangle.cpp
@@ -0,0 +1,77 @@
+/*Write a program in c++ that has a class Triangle and data members side1,side2 and side3.
+//One method calarea() 
+Use default constructor
+Parametrized constructor and copy constructor
+*/
+
+#include<iostream>
+#include<math.h>
+using namespace std;
+
+class Triangle
+{
+	private:
+		float side1,side2,side3;
+		float area;
+	
+	public:
+		Triangle()
+		{
+			side1=6;
+			side2=6;
+			side3=6;
+		}
+		
+		Triangle(float a,float b,float c)
+		{
+			area=0;
+			side1=a;
+			side2=b;
+			side3=c;
+		}
+		Triangle(Triangle &s)
+		{
+			side1=s.side1;
+			side2=s.side2;
+			side3=s.side3;
+		}
+		void calarea()
+		{
+			float s;
+			if(((side1+side2)>side3)||((side1+side3)>side2))
+			{
+				s=(float)(side1+side2+side3)/2;
+				area=(float)sqrt(s*(s-side1)*(s-side2)*(s-side3));
+			}
+			else
+			{
+				cout<<"\nTriangle is not valid";
+			}
+			
+			//cout<<area;
+			
+		}
+		void display()
+		{
+			cout<<"\narea of the triangle:"<<area;
+		}
+		
+};
+
+int main()
+{
+	Triangle s1;
+	s1.calarea();
+	s1.display();
+	
+	Triangle s2(20,25,30);
+	s2.calarea();
+	s2.display();
+	
+	Triangle s3(s2);
+	s3.calarea();
+	s3.display();
+	
+	return 0;
+}
+
