Question: 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
Get step-by-step solutions from verified subject matter experts
