Question: I have my code working on most conversions but when I try to convert 11111111 the program would time out. Help please! Here is my

 I have my code working on most conversions but when I

I have my code working on most conversions but when I try to convert "11111111" the program would time out. Help please!

Here is my code:

#include #include #include using namespace std;

/////////////////// Write Function Here: binToDec

int binToDec(string str){ int res = 0; for(int i = 0; i

//////////////////////////////////////////////////

int main(){ string input; while (true){ cin >> input; if (input =="q") { break; } cout 6.21 Programming 6: Binary to Decimal Students This content is controlled by your instructor, and is not zyBooks content. Direct questions or concerns about this content to your instructor. If you have any technical issues with the zyLab submission system, use the "Trouble with lab?" button at the bottom of the lab. This activity will allow you to try out functions. You will write a function that takes a string as a parameter. The string will have a binary number (a digit with 0's and 1's). The function will convert the binary number to decimal, and return the value. Function must be named "Bin ToDec0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!