{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lab 7 template eas230

lab 7 template eas230 - #include #include...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <iostream> #include <string> #include <math.h> using namespace std; int printMenu(); int hexSymbolValue(char c); int readBinValue( bool vect[] ); int readHexValue( char vect[] ); int binaryToDecimal( bool vect[], int size ); int hexidecimalToDecimal( char vect[], int size ); const int maxInputLength = 255; int main() { while (true) { int choice = printMenu(); // display menu, return user choice switch (choice) { case 0 : return 0; case 1 : { bool myArray[maxInputLength]; int myArraySize; myArraySize = readBinValue( ........ ); int value = ........... ; cout << "result = " << value << endl; break; } // end case 1 Binary to Decimal
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
case 2 : { char myArray[maxInputLength]; int myArraySize; myArraySize = readHexValue( ............ ); int value = .................... ; cout << "result = " << value << endl; break; } // end case2 Hex to Decimal } // end switch } // end while (true) } // end main int printMenu() { while (true) { cout << "---------------------------------------------" << endl; cout << "Please choose a command" << endl; cout << "---------------------------------------------" << endl; cout << "0) Exit " << endl; cout << "1) Convert bin to decimal" << endl; cout << "2) Convert hex to decimal" << endl; cout << endl; char str[maxInputLength]; cin >> str; /********************* TODO: PROVIDE IMPLEMENTATION FOR THIS FUNCTION at this point in the function, make sure the user enters only 0,
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}