Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions C++ Codes/Page.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 3\n2 3\n3 3\n4 3\n5 3\n6 3\n7 3\n8 3\n9 3\n10 3\n11 3\n12 3\n13 3\n14 3\n15 3\n16 3\n17 3\n18 3\n19 3\n20 3\n21 3\n22 3\n23 3\n24 3\n25 3\n26 3\n27 3\n28 3\n29 3\n30 3\n31 3\n32 3\n33 3\n34 3\n35 3\n36 3\n37 3\n38 3\n39 3\n40 3\n41 3\n42 3\n43 3\n44 3\n45 3\n46 3\n47 3\n48 3\n49 3\n50 3\n51 3\n52 3\n53 3\n54 3\n55 3\n56 3\n57 3\n58 3\n59 3\n60 3\n61 3\n62 3\n63 3\n64 3\n65 3\n66 3\n67 3\n68 3\n69 3\n70 3\n71 3\n72 3\n73 3\n74 3\n75 3\n76 3\n77 3\n78 3\n79 3\n80 3\n81 3\n82 3\n83 3\n84 3\n85 3\n86 3\n87 3\n88 3\n89 3\n90 3\n91 3\n92 3\n93 3\n94 3\n95 3\n96 3\n97 3\n98 3\n99 3\n100 3\n101 3\n102 3\n103 3\n104 3\n105 3\n106 3\n107 3\n108 3\n109 3\n110 3\n111 3\n112 3\n113 3\n114 3\n115 3\n116 3\n117 3\n118 3\n119 3\n120 3\n121 3\n122 3\n123 3\n124 3\n125 3\n126 3\n127 3\n128 3\n129 3\n130 3\n131 3\n132 3\n133 3\n134 3\n135 3\n136 3\n137 3\n138 3\n139 3\n140 3\n141 3\n142 3\n143 3\n144 3\n145 3\n146 3\n147 3\n148 3\n149 3\n150 3\n151 3\n152 3\n153 3\n154 3\n155 3\n156 3\n157 3\n158 3\n159 3\n160 3\n161 3\n162 3\n163 3\n164 3\n165 3\n166 3\n167 3\n168 3\n169 3\n170 3\n171 3\n172 3\n173 3\n174 3\n175 3\n176 3\n177 3\n178 3\n179 3\n180 3\n181 3\n182 3\n183 3\n184 3\n185 3\n186 3\n187 3\n188 3\n189 3\n190 3\n191 3\n192 3\n193 3\n194 3\n195 3\n196 3\n197 3\n198 3\n199 3\n200 3\n201 3\n202 3\n203 3\n204 3\n205 3\n206 3\n207 3\n208 3\n209 3\n210 3\n211 3\n212 3\n213 3\n214 3\n215 3\n216 3\n217 3\n218 3\n219 3\n220 3\n221 3\n222 3\n223 3\n224 3\n225 3\n226 3\n227 3\n228 3\n229 3\n230 3\n231 3\n232 3\n233 3\n234 3\n235 3\n236 3\n237 3\n238 3\n239 3\n240 3\n241 3\n242 3\n243 3\n244 3\n245 3\n246 3\n247 3\n248 3\n249 3\n250 3\n251 3\n252 3\n253 3\n254 3\n255 3\n256 3\n257 3\n258 3\n259 3\n260 3\n261 3\n262 3\n263 3\n264 3\n265 3\n266 3\n267 3\n268 3\n269 3\n270 3\n271 3\n272 3\n273 3\n274 3\n275 3\n276 3\n277 3\n278 3\n279 3\n280 3\n281 3\n282 3\n283 3\n284 3\n285 3\n286 3\n287 3\n288 3\n289 3\n290 3\n291 3\n292 3\n293 3\n294 3\n295 3\n296 3\n297 3\n298 3\n299 3\n300 3\n301 3\n302 3\n303 3\n304 3\n305 3\n306 3\n307 3\n308 3\n309 3\n310 3\n311 3\n312 3\n313 3\n314 3\n315 3\n316 3\n317 3\n318 3\n319 3\n320 3\n321 3\n322 3\n323 3\n324 3\n325 3\n326 3\n327 3\n328 3\n329 3\n330 3\n331 3\n332 3\n333 3\n334 3\n335 3\n336 3\n337 3\n338 3\n339 3\n340 3\n341 3\n342 3\n343 3\n344 3\n345 3\n346 3\n347 3\n348 3\n349 3\n350 3\n351 3\n352 3\n353 3\n354 3\n355 3\n356 3\n357 3\n358 3\n359 3\n360 3\n361 3\n362 3\n363 3\n364 3\n365 3\n366 3\n367 3\n368 3\n369 3\n370 3\n371 3\n372 3\n373 3\n374 3\n375 3\n376 3\n377 3\n378 3\n379 3\n380 3\n381 3\n382 3\n383 3\n384 3\n385 3\n386 3\n387 3\n388 3\n389 3\n390 3\n391 3\n392 3\n393 3\n394 3\n395 3\n396 3\n397 3\n398 3\n399 3\n400 3\n401 3\n402 3\n403 3\n404 3\n405 3\n406 3\n407 3\n408 3\n409 3\n410 3\n411 3\n412 3\n413 3\n414 3\n415 3\n416 3\n417 3\n418 3\n419 3\n420 3\n421 3\n422 3\n423 3\n424 3\n425 3\n426 3\n427 3\n428 3\n429 3\n430 3\n431 3\n432 3\n433 3\n434 3\n435 3\n436 3\n437 3\n438 3\n439 3\n440 3\n441 3\n442 3\n443 3\n444 3\n445 3\n446 3\n447 3\n448 3\n449 3\n450 3\n451 3\n452 3\n453 3\n454 3\n455 3\n456 3\n457 3\n458 3\n459 3\n460 3\n461 3\n462 3\n463 3\n464 3\n465 3\n466 3\n467 3\n468 3\n469 3\n470 3\n471 3\n472 3\n473 3\n474 3\n475 3\n476 3\n477 3\n478 3\n479 3\n480 3\n481 3\n482 3\n483 3\n484 3\n485 3\n486 3\n487 3\n488 3\n489 3\n490 3\n491 3\n492 3\n493 3\n494 3\n495 3\n496 3\n497 3\n498 3\n499 3\n500 3\n501 3\n502 3\n503 3\n504 3\n505 3\n506 3\n507 3\n508 3\n509 3\n510 3\n511 3\n512 3\n513 3\n514 3\n515 3\n516 3\n517 3\n518 3\n519 3\n520 3\n521 3\n522 3\n523 3\n524 3\n525 3\n526 3\n527 3\n528 3\n529 3\n530 3\n531 3\n532 3\n533 3\n534 3\n535 3\n536 3\n537 3\n538 3\n539 3\n540 3\n541 3\n542 3\n543 3\n544 3\n545 3\n546 3\n547 3\n548 3\n549 3\n550 3\n551 3\n552 3\n553 3\n554 3\n555 3\n556 3\n557 3\n558 3\n559 3\n560 3\n561 3\n562 3\n563 3\n564 3\n565 3\n566 3\n567 3\n568 3\n569 3\n570 3\n571 3\n572 3\n573 3\n574 3\n575 3\n576 3\n577 3\n578 3\n579 3\n580 3\n581 3\n582 3\n583 3\n584 3\n585 3\n586 3\n587 3\n588 3\n589 3\n590 3\n591 3\n592 3\n593 3\n594 3\n595 3\n596 3\n597 3\n598 3\n599 3\n600 3\n601 3\n602 3\n603 3\n604 3\n605 3\n606 3\n607 3\n608 3\n609 3\n610 3\n611 3\n612 3\n613 3\n614 3\n615 3\n616 3\n617 3\n618 3\n619 3\n620 3\n621 3\n622 3\n623 3\n624 3\n625 3\n626 3\n627 3\n628 3\n629 3\n630 3\n631 3\n632 3\n633 3\n634 3\n635 3\n636 3\n637 3\n638 3\n639 3\n640 3\n641 3\n642 3\n643 3\n644 3\n645 3\n646 3\n647 3\n648 3\n649 3\n650 3\n651 3\n652 3\n653 3\n654 3\n655 3\n656 3\n657 3\n658 3\n659 3\n660 3\n661 3\n662 3\n663 3\n664 3\n665 3\n666 3\n667 3\n668 3\n669 3\n670 3\n671 3\n672 3\n673 3\n674 3\n675 3\n676 3\n677 3\n678 3\n679 3\n680 3\n681 3\n682 3\n683 3\n684 3\n685 3\n686 3\n687 3\n688 3\n689 3\n690 3\n691 3\n692 3\n693 3\n694 3\n695 3\n696 3\n697 3\n698 3\n699 3\n700 3\n701 3\n702 3\n703 3\n704 3\n705 3\n706 3\n707 3\n708 3\n709 3\n710 3\n711 3\n712 3\n713 3\n714 3\n715 3\n716 3\n717 3\n718 3\n719 3\n720 3\n721 3\n722 3\n723 3\n724 3\n725 3\n726 3\n727 3\n728 3\n729 3\n730 3\n731 3\n732 3\n733 3\n734 3\n735 3\n736 3\n737 3\n738 3\n739 3\n740 3\n741 3\n742 3\n743 3\n744 3\n745 3\n746 3\n747 3\n748 3\n749 3\n750 3\n751 3\n752 3\n753 3\n754 3\n755 3\n756 3\n757 3\n758 3\n759 3\n760 3\n761 3\n762 3\n763 3\n764 3\n765 3\n766 3\n767 3\n768 3\n769 3\n770 3\n771 3\n772 3\n773 3\n774 3\n775 3\n776 3\n777 3\n778 3\n779 3\n780 3\n781 3\n782 3\n783 3\n784 3\n785 3\n786 3\n787 3\n788 3\n789 3\n790 3\n791 3\n792 3\n793 3\n794 3\n795 3\n796 3\n797 3\n798 3\n799 3\n800 3\n801 3\n802 3\n803 3\n804 3\n805 3\n806 3\n807 3\n808 3\n809 3\n810 3\n811 3\n812 3\n813 3\n814 3\n815 3\n816 3\n817 3\n818 3\n819 3\n820 3\n821 3\n822 3\n823 3\n824 3\n825 3\n826 3\n827 3\n828 3\n829 3\n830 3\n831 3\n832 3\n833 3\n834 3\n835 3\n836 3\n837 3\n838 3\n839 3\n840 3\n841 3\n842 3\n843 3\n844 3\n845 3\n846 3\n847 3\n848 3\n849 3\n850 3\n851 3\n852 3\n853 3\n854 3\n855 3\n856 3\n857 3\n858 3\n859 3\n860 3\n861 3\n862 3\n863 3\n864 3\n865 3\n866 3\n867 3\n868 3\n869 3\n870 3\n871 3\n872 3\n873 3\n874 3\n875 3\n876 3\n877 3\n878 3\n879 3\n880 3\n881 3\n882 3\n883 3\n884 3\n885 3\n886 3\n887 3\n888 3\n889 3\n890 3\n891 3\n892 3\n893 3\n894 3\n895 3\n896 3\n897 3\n898 3\n899 3\n900 3\n901 3\n902 3\n903 3\n904 3\n905 3\n906 3\n907 3\n908 3\n909 3\n910 3\n911 3\n912 3\n913 3\n914 3\n915 3\n916 3\n917 3\n918 3\n919 3\n920 3\n921 3\n922 3\n923 3\n924 3\n925 3\n926 3\n927 3\n928 3\n929 3\n930 3\n931 3\n932 3\n933 3\n934 3\n935 3\n936 3\n937 3\n938 3\n939 3\n940 3\n941 3\n942 3\n943 3\n944 3\n945 3\n946 3\n947 3\n948 3\n949 3\n950 3\n951 3\n952 3\n953 3\n954 3\n955 3\n956 3\n957 3\n958 3\n959 3\n960 3\n961 3\n962 3\n963 3\n964 3\n965 3\n966 3\n967 3\n968 3\n969 3\n970 3\n971 3\n972 3\n973 3\n974 3\n975 3\n976 3\n977 3\n978 3\n979 3\n980 3\n981 3\n982 3\n983 3\n984 3\n985 3\n986 3\n987 3\n988 3\n989 3\n990 3\n991 3\n992 3\n993 3\n994 3\n995 3\n996 3\n997 3\n998 3\n999 3\n1000 3\n
68 changes: 68 additions & 0 deletions C++ Codes/class.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#include <bits/stdc++.h>
using namespace std;
class Box{
private:
long long int l,b,h;
public:

//Making Constructors...
Box(){ //default constructor...
l=0;b=0;h=0;
}
Box(int l,int b=1,int h=1){ //parameterised constructor...
this->l=l;
this->b=b;
this->h=h;
}
Box(Box &B){ //copy constructor...
l=2*B.l;
b=2*B.b;
h=2*B.h;
}

//Operator Overloading...
friend istream& operator>>(istream &input,Box &B){ //operator>>
input>>B.l>>B.b>>B.h;
return input;
}
friend ostream& operator<<(ostream &output,Box &B){ //operator<<
output<<B.l<<" "<<B.b<<" "<<B.h;
return output;
}

Box operator+(Box &B){ //operator +
Box temp;
temp.l=l+B.l;
temp.b=b+B.b;
temp.h=h+B.h;
return temp;
}

Box operator-(Box &B){ //operator -
Box temp;
temp.l=l-B.l;
temp.b=b-B.b;
temp.h=h-B.h;
return temp;
}
~Box(){ //destructor ...
}
};
int main(){
ios_base::sync_with_stdio(false);
Box B1,B2(2,4,5);
cin>>B1;
Box B3(B1);
Box B4(6),B5(12,5);
cout<<B1<<endl;
cout<<B2<<endl;

Box B6,B7,B8;

B6=B1+B2;
cout<<B6<<endl;

B7=B1-B2;
cout<<B7<<endl;
return 0;
}
27 changes: 27 additions & 0 deletions C++ Codes/data_handling.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <bits/stdc++.h>
using namespace std;
/*
1]Data Persistence
2]Streams-input stream and output stream
*/
int main(){
ios_base::sync_with_stdio(false);
//ofstream's object used for writing in a file
ofstream fout;
fout.open("my_file.txt");
fout<<"Hello\nWorld\n";
fout<<"WeLoveYou";
fout.close();
//ifstream.s object used for reading from file
ifstream fin;
fin.open("my_file.txt");
char ch;
fin>>ch; //also ch=fin.get()
while(!fin.eof()){
cout<<ch;
fin>>ch; //also ch=fin.get()
}
fin.close();

return 0;
}
12 changes: 12 additions & 0 deletions C++ Codes/file_opening_modes.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
ofstream fout;
fout.open("Page.txt");
for(int i=1;i<=1000;i++){
fout<<i<<" 3\\n";
}
fout.close();
return 0;
}
40 changes: 40 additions & 0 deletions C++ Codes/friend_function.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include <bits/stdc++.h>
using namespace std;
class friend_function2;
class friend_function1{
private:
int a,b,c,d;
public:
void get_data(){
cin>>a>>b>>c>>d;
}
void show_data(){
cout<<a<<endl<<b<<endl<<c<<endl<<d<<endl;
}
friend int add(friend_function1,friend_function2);
};
class friend_function2{
private:
int a,b,c,d;
public:
void get_data(){
cin>>a>>b>>c>>d;
}
void show_data(){
cout<<a<<endl<<b<<endl<<c<<endl<<d<<endl;
}
friend int add(friend_function1,friend_function2);
};
int add(friend_function1 z,friend_function2 y){
return z.a+z.b+z.c+z.d+y.a+y.b+y.c+y.d;
}
int main(){
friend_function1 ff;
friend_function2 gg;
ff.get_data();
ff.show_data();
gg.get_data();
gg.show_data();
cout<<add(ff,gg)<<endl;
return 0;
}
Binary file added C++ Codes/hack
Binary file not shown.
4 changes: 4 additions & 0 deletions C++ Codes/my_file.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Hello
World
WeLoveYouHello
World
68 changes: 68 additions & 0 deletions C++ Codes/operator_overloading.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#include <bits/stdc++.h>
using namespace std;
class complex_number{
private:
int a,b;
public:
void get_data(){
cin>>a>>b;
}
void show_data(){
cout<<a<<" "<<b<<endl;
}
complex_number operator+(complex_number c){ //binary operator +
complex_number temp;
temp.a=a+c.a;
temp.b=b+c.b;
return temp;
}
complex_number operator-(){ //unary operator -
complex_number temp;
temp.a=-a;
temp.b=-b;
return temp;
}
complex_number operator++(int){ //pre-increment ++
complex_number temp;
temp.a=++a;
temp.b=++b;
return temp;
}
complex_number operator--(int){ //pre-increment ++
complex_number temp;
temp.a=--a;
temp.b=--b;
return temp;
}
complex_number operator++(){ //post-increment ++
complex_number temp;
temp.a=a++;
temp.b=b++;
return temp;
}
complex_number operator--(){ //post-increment ++
complex_number temp;
temp.a=a++;
temp.b=b++;
return temp;
}

};
int main(){
complex_number c1,c2,c,c3,c4,c5;
c1.get_data();
c2.get_data();
c=c1+c2;
c3=-c;
cout<<endl;
c.show_data();
cout<<endl;
c3.show_data();
c4=c++;
c.show_data();
c4.show_data();
c5=++c;
c.show_data();
c5.show_data();
return 0;
}
29 changes: 29 additions & 0 deletions C++ Codes/static_members.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <bits/stdc++.h>
using namespace std;
class account{
int balance; //Insatnce Member Variable
static double roi; //Static(Class) Member Variable
public:
void set_balance(int b){
balance = b;
}
static void set_roi(double r){ //Static Member Function
roi=r;
}
void show_roi(){ //Instance Member Function
cout<<roi<<endl;
}
void show_balance(){ //Instance Member Function
cout<<balance<<endl;
}
};
double account :: roi=4.5; //must be declared outside the class
int main(){
account sujeet,manit;
sujeet.set_balance(1000000);
account :: set_roi(9.67); //Static Member Function can be called without an object
sujeet.show_balance();
sujeet.show_roi();
manit.show_roi();
return 0;
}