1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
#include <iostream>
#include <string>
using namespace std;
//samthewildone
//POLYMORPHSIM + OVERLOADED FUNCTIONS
//POINTERS + MEM ADDRESSES
//CLASSES
int numberint(int n1, int n2, int n3);
int numberint(int n1, int n2, int n3, int n4);
int numberint(int n1, int n2, int n3, int n4, int n5);
int main()
{
int numPointer = 100;
int *pointer = &numPointer; // Pointer is MEM ADDRESS to numPointer
int n1 = 10;
int n2 = 20;
int n3 = 30;
int n4 = 40;
int n5 = 50;
cout << numberint(n1,n2,n3) << endl; // ORGINAL FUNCTION
cout << numberint(n1,n2,n3,n4) << endl; // OVERLOADED NUMBERINT
cout << numberint(n1,n2,n3,n4,n5) << endl; // OVERLOADED NUMBERINT
cout << numberint(n4,n5,n1) << endl; // IDK WHAT THIS IS (OVERLOADED ?)
cout << numberint(n1,n4,n2) << endl; // IDK WHAT THIS IS (OVERLOADED ?)
cout << &numPointer << " is the MEM ADDRESS of numPointer using & == ADDRESS " << endl; //mem ADDRESS of numPointer
cout << pointer << " is the MEM ADDRESS of numPointer " << endl; //mem ADDRESS of numPointer
cout << *pointer << " is the VALUE of numPointer" << endl; //mem VALUE for numPointer == 100
return 0;
}
// INT with 3 arguments
int numberint(int n1, int n2, int n3)
{
//n1 = 10;
//n2 = 20;
//n3 = 30;
return (n1+n2+n3);
}
// INT with 4 arguments + OVERLOADED
int numberint(int n1, int n2, int n3,int n4)
{
//n1 = 10;
//n2 = 20;
//n3 = 30;
//n4 = 40;
return (n1+n2+n3+n4);
}
// INT with 5 arguments + OVERLOADED
int numberint(int n1, int n2, int n3, int n4, int n5)
{
//n1 = 10;
//n2 = 20;
//n3 = 30;
//n4 = 40;
//n5 = 50;
return (n1+n2+n3+n4+n5);
}
|