#include <iostream>
using namespace std;
void showArray(int numbers[], const int SIZE);
int main() {
//____________________________________________________________
//| Intel processors |
//|1974- 8086 - Each instruction is 8 bits: 01001010 |
//| 80186 |
//|1985- 80286 |
//| |
//|1991- 80386- 16 bit processor (instructions are 16 bits) |
//| 10101010101010101 |
//| |
//|1995- 80486 32 bit processor (32 bit instructions) |
//| 100101010010101010101010 |
//|2000- 64 bit processor - 64 bit instructions |
//| 1001010101001010110001011010 |
//|Memory addresses are 16 bits. |
//|0000000000000000 00000000 |
//|0000000000000001 00000000 |
//|0000000000000010 00000000 |
//|0000000000000011 00000000 |
//|0000000000000100 00000000 |
//| |
//|0000000011001000 00000000 |
//|1000 000000000 |
//|1111111111111111 00000000 |
//|__________________________________________________________|
int num1;
int num2;
int sum;
cin>>num1;
cin>>num2;
sum = num1 + num2;
cout<<"Enter number 1: "<<num1<<endl;
cout<<"Enter number 2: "<<num2<<endl;
cout<<"The sum of the two numbers is: "<<num1<<" + "<<num2<<" = "<<sum<<endl;
//Array concept:
const int SIZE = 5;
int numbers[SIZE] = {1,2,3,4,5};
int values[SIZE] = {1,2,3,4,5};
showArray(numbers,SIZE);
cout<<numbers<< endl;
if(numbers == values)
{
cout<<"They have the same base address."<<endl;
}
else
{
cout<<"Not the same base address."<<endl;
}
/*
Binary numbers (2 digits) 0 1
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 A
1011 B
1100 C
1101 D
1110 E
1111 F
Hexadecimal numbers: (16 digits) 0 1 2 3 4 5 6 7 8 9 A B C D E F
0 0 F D F C 4 8
00000000
*/
//Introduction to pointers:
int value = 3;
int* ptr = &value;
cout<< value<<" pointer value transfer cell holder: "<< ptr<<endl;
/*
Example:
0000000000000000000000000000001
int numbers [3]={1,2,3};
string cities[3] = {"New York", "Boston", "Phoenix"};
cout << cities [1];
cities[0] 00000001 000000000000000000000000001
00000000
00000000
00000000
cities[1] 00000010 000000000000000000000000010
00000000
00000000
00000000
cities[2] 00000011 000000000000000000000000011
00000000
00000000
00000000
*/
string cities[3] = {"New York", "Boston", "Phoenix"};
cout <<"String array number "<<1<<" contains : "<< cities [1]<<endl;
//Example # 5:
char grades[5] = {'A','B','C','D','E'};
cout<<"Student 1 Grade: "<<grades[1]<<endl;
/*
[0] 01000001 = 65 = 'A' ASCII table
D B
0 = 0
1 = 1
2 = 10
3 = 100
01000001= 64 + 1 = 65
ASCII Table is the international to Standard to arange bits into numbers
and converts them into letters
Grade[0] 01000001 = 65 = 'A'
Grade[1] 01000010 = 66 = 'B'
Grade[2] 01000011 = 67 = 'C'
Grade[3] 01000100 = 68 = 'D'
Grade[4] 01000101 = 69 = 'E'
*/
return 0;
}
void showArray(int numbers[], const int SIZE)
{
for(int i=0; i<SIZE; i++)
cout<<"This is a number "<<i<< " in the array: "<< numbers[i]<<endl;
}