hi @prashanthth not sure what exactly you mean by a “paragraph” but clearly your code doesn’t seem to be a good one. You don’t need to use a for loop.
I assume that you basically want to input a string which has spaces, and since you do not want to use a gets() you can use an alternative ie getline(). For that you can use this in c++:
cout << a;
If that doesn’t answer your question, i would request you be a little more specific as to what your requirement is, or even post the problem link which you are solving.