Since my (last post) I had been trying to make a Binary to Decimal calculator, also using C++. I went for a different method this time, and now the binary supports over 8 digits.
Credit to: https://geeksforgeeks.org/
Code:
#include <iostream>
using namespace std;
int main() {
char binaryNumber[] = "0101010101010101010101010101010101";
string session = "y";
while (session == "y") {
cout << "\nEnter a Binary number (1s and 0s): ";
cin >> binaryNumber;
cout << "\n";
cout << stoi(binaryNumber, 0, 2);
session = "y";
cout << "\nContinue session? [y/n]\n";
cin >> session;
cout << "\x1B[2J\x1B[H";
} // end of session
cout << "Credit to https://geeksforgeeks.org/ for helping me with some of "
"this code!\n";
return 1;
}
`
Changelog#1(Fri, Jun 3rd):
Fixed formatting
Top comments (0)