Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

How to get input of Full Name and print it?

+1 vote
asked Jul 8, 2018 by zankdude (130 points)
I am having a problem in c++

I want my program to take input of full name(like - Agatha Christie) in char x and then get output of that

(Agatha Christie)

4 Answers

0 votes
answered Jul 9, 2018 by anonymous
Instead of using scanf("%s")

Try

scanf("%[^\n]s",&x);
0 votes
answered Jul 10, 2018 by nawab

#include<iostream.h>

#include<string.h>

void main ()

{

  char x[25];

  cout<<"ENTER YOUR FULL NAME";

  getsline(x,25);

cout<<"/n"<<"("<<x<<")";

getch();

}

0 votes
answered Jul 21, 2018 by Priyansh (230 points)
#include<stdio.h>

void main()

{

     char x;

     printf("enter your Full Name: );

     scanf("%c",&x);

     printf("%c", &x);

     getch();

}
0 votes
answered Jul 21, 2018 by Akhila Mekapothula (460 points)
#include<stdio.h>

main()

{

char name[20];

printf("enter name\n");

scanf("%[^\n]",name);

printf("name=%s",name);

}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...