Answer to Question #182447 in C++ for VASANTH

Question #182447

Develop a C++ program to use skipws flags which skips white space on input of three words.


1
Expert's answer
2021-04-17T03:07:51-0400
#include <iostream>
#include <sstream>
using namespace std;
int main(){
    string input, word1, word2, word3;
    cout<<"Enter three words separated by white spaces;\n";
    getline(cin, input);
    istringstream iss(input);
    iss>>skipws>>word1>>word2>>word3;
    cout<<word1<<endl<<word2<<endl<<word3;
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS