hi ..
suppose there is a line at the command prompt with variable number of spaces . How can i scan it in a C++ string ??
a) cin cannot be used as it cannot scan spaces ...and scanf,gets cannot be used as it is a C++ string
If the line was in a file , i could have used
ifstream in("input.txt") ;
int main(){
string line
getline(in,line );
------------------
}
but if the line is at the command prompt then how do i scan it ??
debjani
suppose there is a line at the command prompt with variable number of spaces . How can i scan it in a C++ string ??
a) cin cannot be used as it cannot scan spaces ...and scanf,gets cannot be used as it is a C++ string
If the line was in a file , i could have used
ifstream in("input.txt") ;
int main(){
string line
getline(in,line );
------------------
}
but if the line is at the command prompt then how do i scan it ??
debjani
Comment