-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 81ebfa8
Showing
160 changed files
with
2,995 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#inculde<iostresam> | ||
using namespace std | ||
|
||
class |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include<iostream> | ||
#include<string.h> | ||
using namespace std; | ||
class data | ||
{ | ||
char *a; | ||
public: | ||
data(char *b) | ||
{ | ||
a= new char(strlen(b)+1); | ||
strcpy(a,b); | ||
} | ||
void show() | ||
{ | ||
a[0]=a[0]-32; | ||
cout<<"\n"<<a; | ||
} | ||
void compare(data d2) | ||
{ | ||
if(strcmp(d2.a,a)) | ||
cout<<"\nBoth Objects have different text"; | ||
else | ||
cout<<"\nBoth Objects have same text"; | ||
} | ||
|
||
}; | ||
|
||
|
||
|
||
|
||
int main() | ||
{ | ||
data d1("obfuscation"); | ||
data d2("obstruction"); | ||
d1.show(); | ||
d2.show(); | ||
d1.compare(d2); | ||
return 0; | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#include<iostream> | ||
using namespace std; | ||
|
||
/******************************************************** Class ********************************************************/ | ||
|
||
|
||
class matrix | ||
{ | ||
int **ptr; | ||
int d1,d2; | ||
|
||
public: | ||
matrix (int x,int y) | ||
{ | ||
d1=x; | ||
d2=y; | ||
ptr = new int *[d1]; | ||
for(int i=0; i<d1; i++) | ||
{ | ||
ptr[i]=new int[d2]; | ||
} | ||
} | ||
|
||
void getval(int i,int j,int val) | ||
{ | ||
ptr[i][j]=val; | ||
} | ||
|
||
int & putval(int i,int j) | ||
{ | ||
return (ptr[i][j]); | ||
} | ||
}; | ||
|
||
/******************************************************** Main ********************************************************/ | ||
|
||
|
||
int main() | ||
{ | ||
int m,n,value; | ||
|
||
cout<<"Enter size of matrix"; | ||
cin>>m>>n; | ||
|
||
matrix A(m,n); | ||
|
||
cout<<"Enter elements of matrix"; | ||
|
||
for(int i=0; i<m; i++) | ||
{ | ||
for(int j=0; j<n; j++) | ||
{ | ||
cin>>value; | ||
A.getval(i,j,value); | ||
} | ||
} | ||
|
||
cout<<"\n"<<A.putval(1,1); | ||
return 0; | ||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include<iostream> | ||
using namespace std; | ||
|
||
class arr{ | ||
public: | ||
|
||
int insert(int *ptr,int pos,int n,int num){ | ||
int temp[100],j; | ||
for(int i=0;i<n+1;i++){ | ||
if(i==pos){ | ||
temp[i]=num; | ||
j--; | ||
} | ||
|
||
temp[i]=arr[j]; | ||
j++; | ||
} | ||
} | ||
|
||
void | ||
}; |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#include<iostream> | ||
using namespace std; | ||
class persondata{ | ||
int birthmonth,birthyear; | ||
float cm,meters; | ||
int currentmonth,currentyear; | ||
int agey,agem; | ||
|
||
public: | ||
|
||
void getdata(){ | ||
cout<<"Enter Your Birth Year:"; | ||
cin>>birthyear; | ||
cout<<"\nEnter Your Birth Month:"; | ||
cin>>birthmonth; | ||
cout<<"\nEnter The Current Month:"; | ||
cin>>currentmonth; | ||
cout<<"\nEnter The Current Year:"; | ||
cin>>currentyear; | ||
cout<<"\nEnter Your Height in Meters:"; | ||
cin>>meters; | ||
} | ||
|
||
void calc(){ | ||
int m; | ||
cm=meters*100; | ||
agey=currentyear-birthyear; | ||
m=currentmonth-birthmonth; | ||
if(m<0){ | ||
agey=currentyear-birthyear+m; | ||
agem=12+m;} | ||
|
||
} | ||
|
||
void putdata(){ | ||
cout<<"\nYour Age is "<<agey<<" Years And "<<agem<<" Months and Height in Centimeter is "<<cm; | ||
} | ||
}; | ||
|
||
int main() | ||
{ | ||
persondata per; | ||
per.getdata(); | ||
per.calc(); | ||
per.putdata(); | ||
|
||
|
||
return 0; | ||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include<iostream> | ||
using namespace std; | ||
|
||
class ptr{ | ||
int arr[100]; | ||
public : | ||
|
||
void getarr(int n){ | ||
for(int i;i<n;i++){ | ||
cin>>arr[i]; | ||
} | ||
} | ||
|
||
void sort (int n){ | ||
int temp=0; | ||
|
||
for(int i=0;i<n;i++){ | ||
for(int j=0;j<n-1;j++){ | ||
if (arr[j]>arr[j+1]){ | ||
temp = arr[j]; | ||
arr[j] = arr[j+1]; | ||
arr[j+1] = temp; | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
void putarr(int n){ | ||
for(int i;i<n;i++){ | ||
cout<<arr[i]; | ||
} | ||
} | ||
}; | ||
|
||
int main(){ | ||
ptr obj; | ||
int n; | ||
|
||
cout<<"Enter the no elements"<<endl; | ||
cin>>n; | ||
|
||
obj.getarr(n); | ||
obj.sort(n); | ||
obj.putarr(n); | ||
|
||
} | ||
|
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int i=0; | ||
class ary | ||
{ | ||
int arr[10]; | ||
int size; | ||
public: | ||
ary(); | ||
ary(int n); | ||
void showdata(); | ||
friend ary operator +(ary,ary); | ||
}; | ||
|
||
ary::ary() | ||
{ | ||
for(i=0; i<10; i++) | ||
{ | ||
arr[i]=0; | ||
} | ||
size=0; | ||
} | ||
|
||
ary::ary(int n) | ||
{ | ||
for(i=0; i<n; i++) | ||
{ | ||
cin>>arr[i]; | ||
size=n; | ||
} | ||
} | ||
|
||
void ary:: showdata() | ||
{ | ||
// cout<<"\n------------------"<<size<<"------------------\n"<<endl; | ||
for(i=0; i<size; i++) | ||
{ | ||
cout<<arr[i]<<endl; | ||
} | ||
} | ||
|
||
ary operator +(ary a1,ary a2) | ||
{ | ||
ary temp; | ||
temp.size=a1.size; | ||
int i; | ||
for(i=0; i<a1.size; i++) | ||
{ | ||
temp.arr[i]=a1.arr[i]+a2.arr[i]; | ||
//cout<<"Temp\t\t"<<temp.arr<<endl; | ||
} | ||
return temp; | ||
} | ||
|
||
int main() | ||
{ | ||
int n; | ||
cout<<"Enter Size"<<endl; | ||
cin>>n; | ||
|
||
ary A(n),B(n),C; | ||
C=A+B; | ||
|
||
cout<<"The final Array is:"<<endl; | ||
|
||
C.showdata(); | ||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#include<iostream> | ||
using namespace std; | ||
|
||
class complex | ||
{ | ||
float real,img; | ||
|
||
public: | ||
|
||
complex() | ||
{ | ||
real=0; | ||
img=0; | ||
} | ||
|
||
complex(float x,float y) | ||
{ | ||
real=x; | ||
img=y; | ||
} | ||
|
||
complex operator +(complex); | ||
|
||
void display() | ||
{ | ||
cout<<real<<"+"<<img<<"i"<<endl; | ||
} | ||
}; | ||
|
||
complex complex:: operator +(complex a) | ||
{ | ||
complex temp; | ||
temp.real=real+a.real; | ||
temp.img=img+a.img; | ||
// cout<<a.real<<"*******"<<endl; | ||
return temp; | ||
} | ||
|
||
int main() | ||
{ | ||
complex c1(12.5,22.6),c2(36.4,12.5); | ||
|
||
complex c3; | ||
|
||
c3=c1+c2; | ||
|
||
c1.display(); | ||
c2.display(); | ||
c3.display(); | ||
|
||
return 0; | ||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#include<iostream> | ||
using namespace std; | ||
|
||
class faran{ | ||
float fr; | ||
|
||
public: | ||
faran(int fff=50){ | ||
fr =fff; | ||
} | ||
|
||
|
||
float getval(){ | ||
return fr; | ||
} | ||
}; | ||
|
||
class celc{ | ||
float cl; | ||
|
||
public: | ||
|
||
celc(); | ||
|
||
celc(faran f){ | ||
//cout<<f.getval(); | ||
cl=((f.getval() - 32) * .5555556); | ||
} | ||
|
||
void showdata(){ | ||
cout<<cl<<"degree celcius"; | ||
} | ||
|
||
|
||
}; | ||
|
||
|
||
int main(){ | ||
faran f; | ||
celc c(f); | ||
|
||
c.showdata(); | ||
} |
Binary file not shown.
Oops, something went wrong.