Hello, i'm trying to write a simple program just to enter Characters from the keyboard and concatenate the 5 chars into one string. The code below reports a problem at line 21 with 'cannot convert from 'char [1]' to 'char'' error. Can anybody help??
I know there will be a better and more elegant way to do this, but I'm only a beginner so please excuse my lack of knowledge.
#include <cstdio>
#include <cstdlib>
#include <iostream>
usingnamespace std;
// roman numeral conversion
class romanType
{
public:
void inputRomanLetters()
{
int nCounter = 0; // loop counter
char letters[1]; // input 6 letters one at at a time;
for (nCounter=1; nCounter < 6; nCounter++) //repeat 5 times
{
cout << "enter letter - T to quit: ";
cin.getline(letters,1); // get one text character
RomanLetters[nCounter] = letters; // add this character to class member RomanLetters
}
}
private:
char RomanLetters[8];
// int Decimalversion;
};
int main(void)
{
romanType rT1;
rT1.inputRomanLetters();
system("PAUSE");
}