From 7783b6106088e6b42b6c672d2924636d30d1588b Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Tue, 15 Oct 2019 10:43:42 -0500 Subject: I should probably pay attention --- ee2301/baseConvert.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ee2301') diff --git a/ee2301/baseConvert.cpp b/ee2301/baseConvert.cpp index 486a68f..d675741 100644 --- a/ee2301/baseConvert.cpp +++ b/ee2301/baseConvert.cpp @@ -2,6 +2,7 @@ // to decimal #include #include +#include // To return value of a char. For example, 2 is // returned for '2'. 10 is returned for 'A', 11 @@ -47,7 +48,9 @@ int main() { char str[] = "11A"; int base = 16; - printf("Decimal equivalent of %s in base %d is " + printf("Please enter number followed by base: "); + std::cin >> str >> base; + printf("Decimal equivalent of %s in base %d is" " %d\n", str, base, toDeci(str, base)); return 0; -- cgit v1.2.3