Answered step by step
Verified Expert Solution
Question
1 Approved Answer
string to_binary(char c) {} returns 5 bit string that is the index of the character argument. if the provided character is not a lower-case alphabetic
string to_binary(char c) {}
returns 5 bit string that is the index of the character argument.
if the provided character is not a lower-case alphabetic character, return the empty string.
need help with this function above c++
(i need a function called string to_binary(char c). There is already a main function that calls in for the string. This function is just supposed to check if the character is lowercase and convert it to binary)
#includeusing std::cout; using std::cin; using std::endl; using std::boolalpha; #include using std::string; #include "proj05_functions.h" int main (){ cout << boolalpha; int testnum; cin >> testnum; switch (testnum){ case 1: { string s; getline(cin,s); cout << lower_case(s) < > c; cout << to_binary(c) < > n; cout << from_binary(n) << endl; break; } case 4: { string plain, secret; getline(cin, plain); getline(cin,secret); cout << check_message(plain, secret) << endl; break; } case 5: { string plain, secret; getline(cin, plain); getline(cin,secret); cout << encode(plain, secret) << endl; break; } case 6: { string encoded; getline(cin, encoded); cout << decode(encoded) << endl; break; } }// of switch } // of main
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started