what binary numbers mean
how to convert from base 2 to base 10
how to convert from base 10 to base 2
octal, hexademical numbers to binary and back
base 8, base 16
how do we count in hex?
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
0 - 0000
1 - 0001
2 - 0010
3 - 0011
4 - 0100
5 - 0101
6 - 0110
7 - 0111
8 - 1000
9 - 1001
A - 1010
B - 1011
C - 1100
D - 1101
E - 1110
F - 1111
Lecture HW#1:
1) Convert these decimal numbers to binary:
7
14
103
2) Convert these binary numbers to decimal:
11001
110
11
1101
3) Convert those numbers in part 2 to octal.
4) Convert those numbers in part 2 to hexadecimal.
programming languages
low-level languages
one very close to the actual instruction set of the CPU
00100010010100101100100000001111100101010
machine language
assembly language
mov ax, 4
mov bx, 3
add ax, bx
correspondence between assembly instructions and machine
mov 00100
ax 0001
bx 0010
http://en.wikipedia.org/wiki/Assembly_language
high-level languages
http://en.wikipedia.org/wiki/High-level_language
Some C++ code to calculate costs:
http://www.functionx.com/cpp/examples/ifelse1.htm
#include <iostream>
using namespace std;
void main()
{
unsigned int Miles;
const double LessThan100 = 0.25;
const double MoreThan100 = 0.15;
double PriceLessThan100, PriceMoreThan100, TotalPrice;
cout << "Enter the number of miles: ";
cin >> Miles;
if(Miles <= 100)
{
PriceLessThan100 = Miles * LessThan100;
PriceMoreThan100 = 0;
}
else
{
PriceLessThan100 = 100 * LessThan100;
PriceMoreThan100 = (Miles - 100) * MoreThan100;
}
TotalPrice = PriceLessThan100 + PriceMoreThan100;
cout << "\nTotal Price = $" << TotalPrice << "\n\n";
}
compiler
interpreter
Java, C++ compiled language
JavaScript, python
No comments:
Post a Comment