#include //#include using namespace std; //string_cin_copmare1.cpp int main() { string str1, str2; cout<<" restricted word is exit to quit \n"; cout<<" Type a line: "; int i; i = 0; while (1) { i++; //getline(cin, s); It will print lines till you type exit cin>>str1; // this will take a recurring strings with cin if (cin.fail()) { cout <<"\n cin.falied" ;} else{ cout << "\t\b String " << i << ": " << str1 << endl; } if(str1=="exit"){ return 0; } } return 0; }