View Single Post
Old Dec 2nd, 2005, 3:24 PM   #40
Planet_EN
Programmer
 
Join Date: Mar 2005
Posts: 40
Rep Power: 0 Planet_EN is an unknown quantity at this point
Quote:
Originally Posted by Magius Avvail
Oh, man... :p You are rich - I tell ya... You, are, priceless.
Awkward enough, my friend recites that latter comment quite a bit... *is now suspicious*

Anyway, seriously, now. Which header do I use to enable the 'string' function?

Well, There's no header in Turbo C++ 3.1 which can "enable" or "provide" you string function (or class ...or whatever you want to say it...)

Although there are some way you have in Turbo C++ to input a full string.
The simplest you'd find is:
char *str;
str = new char; // for avoiding comipler runtime errors
cin >> str;

But it'll ignore everything after the whitespace(after you hit spacebar while entering a string).
To overcome this problem, try any of the below listed suggestions:

Through getline():
cin.getline(str);
cin.getline ( str, sizeof(str), '\n');

Through get():
cin.get( str, sizeof(str) );
cin.get( str, sizeof(str), '\n' );

Through read():
cin.read( str, sizeof(str) );
Planet_EN is offline   Reply With Quote