How to Do Enter For Space in array of char in c++? -


my code here:

char s[50];  cin.get(s,50);  (int = 0; < 50; i++) {     if (s[i] = ' ')     {         //suppose enter     }  } cout << s << endl; 

input:

welcome c++ 

expected output :

welcome c++ 

this work:

char s[50]; cin.get(s,50); (int = 0; < 50; i++){     if (s[i] == ' '){       s[i]='\n';  //suppose enter       }     } cout << s << endl; 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -