Answers for "how to take space separated input in c"

C++
1

how to store a user input with spaces in c

#include <stdio.h>

int main(){
    char name[20];

    printf("Enter a name : ");
    scanf("%[^n]%*c", &name);

    printf("the name entered is: %sn", name);

return 0;
}
Posted by: Guest on June-07-2020
0

how to read space separated words in c

scanf("%[^n]%*c", ref_string);
Posted by: Guest on November-13-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
0

how to take comma separated integer input in c

scanf("%d,",&arr[i]);
Posted by: Guest on November-24-2020

Code answers related to "how to take space separated input in c"

Browse Popular Code Answers by Language