-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHex lab.cpp
45 lines (37 loc) · 843 Bytes
/
Hex lab.cpp
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
// HEX lab.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
void printArr(char[], int);
void input(char[], int);
int _tmain(int argc, _TCHAR* argv[])
{
char num1[10] = { '0', '0', '0', '0', '0', '0', '0', '0', '0', '0' };
char num2[10] = { '0', '0', '0', '0', '0', '0', '0', '0', '0', '0' };
cout << "Enter the first hex num ";
input(num1, 10);
//cout << "\nEnter the second hex num ";
system("pause");
return 0;
}
void input(char num[], int size) //input the data into the hex arrays
{
char holdVal = '0';
int i = 0;
while (holdVal != 'CR' || i != 9)
{
cin >> holdVal;
num[i] = holdVal;
i++;
}
printArr(num, size);
}
void printArr(char arr[], int size)
{
for (int i = 0; i < size; i++)
{
cout << arr[i] << endl;
}
}