-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
38 lines (36 loc) · 923 Bytes
/
main.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
#include <iostream>
#include <string>
#include "ascii_to_binary.h"
int main()
{
while (true)
{
std::cout << "ASCII To Binary/Binary To ASCII - Berkay Gediz\n";
std::cout << "Enter the character: ";
try
{
char key;
std::cin >> key;
AsciiToBinary(key);
}
catch (const std::exception &e)
{
std::cout << "Error: " << e.what() << std::endl;
}
std::cout << "\nEnter the binary string (8 digit): ";
try
{
std::string binaries;
std::cin >> binaries;
BinaryToAscii(binaries);
}
catch (const std::exception &e)
{
std::cout << "Error: " << e.what() << std::endl;
}
std::cout << "\nPress Enter to continue, or Ctrl+C to exit.";
std::cin.ignore();
std::cin.get();
}
return 0;
}