Answers for "how to input space separated string in c++"

C++
4

c++ reading string

#include <iostream>
#include <string>
string str;
getline(cin, str);
//str contains line
Posted by: Guest on January-26-2020
1

how to take space separated input in c++

string z,s;
 while (true)
    {
      cin>>z;
      s+=z;
      if(cin.peek()=='n')
      break;
    }
................................
	        OR/
.................................
string s;
getline(cin,s);
Posted by: Guest on July-10-2021

Code answers related to "how to input space separated string in c++"

Browse Popular Code Answers by Language