I am in a beginners programming class and for our assignment we are asked to convert a string of letters/words to braille. For some reason I cannot seem to figure out how to make my string separate my input and output each character that is associated with its braille definition.
Here is a portion of my code:
#include <iostream>
#include <cstring>
using namespace std;
int main(){
string str1;
getline(cin, str1);
int n = str1.length();
char cstr[n + 1];
strcpy(cstr, str1.c_str());
if( cstr == 'a')
cout << "|--|\n|* |\n| |\n| |\n|--|";
if( cstr == 'b')
cout << "|--|\n|* |\n|* |\n| |\n|--|";
}
I have tried looking up different ways online to convert strings to char. However, none of them seem to work on my code.
I keep receiving the message:error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
I have no idea how to fix this issue. Any help would be appreciated.
Note: This is not my complete code. I just wanted to show the part that is giving me problems.