I thought I would try and write some encryption program that converts input to numbers in a file.
I made a table, giving each letter its own number. The code itself went a little like this for each letter:
if (Letter = "P") { FILEO.open("Encrypted.txt", ios::app); FILEO << " 259"; FILEO.close(); } It came up with "cannot convert from 'const char [2]' to 'char'"
Can anyone suggest how I would go about actually getting a number from a letter?
Letter? Is it a string, or a character array?Letteris achar. Using double quotes makes a string literal. To just denote the character P, use single quotes'P'. Also, are you really trying to setLetter(=), or check its value (==)?