Date: Wed, 31 Dec 97 22:45:28 PST From: Noam Rotem Subject: RE: Input/Output To: Erik Cc: djgpp AT delorie DOT com Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Precedence: bulk --- On 31 Dec 1997 18:00:48 GMT Erik wrote: >#include > >int main() >{ >char txt; > >cout << "Print a string: " << endl; > >So far I´ve got variable of the type CHAR called "txt". In txt should that >you write be stored. > >Then the program will ask me to write something. >Here is my problem. How should I store that write in the variable "txt"? When you input a string, you can't store it in a single char. You have to make room for a whole STRING, i.e - an *array* of chars. Try the following code: ------------------------------------- char Txt[30+1]; /* Declares an array of 30 characters + a place for a special terminator (called NULL terminator), which marks the end of the actual string. 30 chars might be too little - modify it as needed. */ cout << "Print a string: " << endl; cin >>Txt; /* Inputs a string and stores it in Txt */ cout<