MP_02 start

This commit is contained in:
Johannes Theiner 2018-03-16 18:03:32 +01:00
parent 9f9705eb26
commit a1c05e422a
5 changed files with 27 additions and 8 deletions

BIN
02_MENT/a.out Executable file

Binary file not shown.

11
02_MENT/build.sh Normal file → Executable file
View File

@ -1,3 +1,10 @@
#!/bin/bash #!/bin/bash
clang++ -std=c++14 -I../helpers/ -o limits.out limits_println.cpp
clang++ -std=c++14 -I../helpers/ -o println.out printlnDemo.cpp rm *.out
clang++-6.0 -std=c++14 -I../helpers/ -o limits.out limits_println.cpp
clang++-6.0 -std=c++14 -I../helpers/ -o println.out printlnDemo.cpp
clang++-6.0 -std=c++14 main_02_MENT.cpp
./a.out

BIN
02_MENT/limits.out Executable file

Binary file not shown.

View File

@ -1,17 +1,24 @@
// file: main_02_MENT.cpp // file: main_02_MENT.cpp
// THIS IS C++, use clang++ // THIS IS C++, use clang++
#include "../helpers/println.hpp"
#include <iostream> #include <iostream>
#include "../helpers/println.hpp"
struct PascalString{ struct PascalString{
int length; // number of chars used int length; // number of chars used
char characters[256]; // chars of some character string char characters[256]; // chars of some character string
}; };
int hexDigitToInt(char hexDigit) { int hexDigitToInt(char hexDigit) {
int value = -1; int value = 0;
// TBD
if(hexDigit > 47 && hexDigit < 58)
value = hexDigit - 48;
if(hexDigit > 96 && hexDigit < 103)
value = hexDigit - 97 + 10;
return value; return value;
} }
@ -26,6 +33,11 @@ int main(int argc, char** argv, char** envp){
PascalString s2 = {4, 'f', 'f', 'f', 'f'}; PascalString s2 = {4, 'f', 'f', 'f', 'f'};
println(hexStringToInt(s)); println(hexStringToInt(s));
println(hexStringToInt(s2)); println(hexStringToInt(s2));
println(hexDigitToInt('D'));
println(hexDigitToInt('9'));
println(hexDigitToInt('2'));
return 0; return 0;
} }

BIN
02_MENT/println.out Executable file

Binary file not shown.