char input problems


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.




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <cstdio>
#include <cstdlib>
#include <iostream>

using namespace 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");
		
}
RomanLetters[nCounter] = letters[0];
Topic archived. No new replies allowed.