Write a C++ program to read and display an entire line entered by user.
Note: If you want to consider space in your string input then please use cin.get(string_name, string_size) format to take input like in the below program.
#include <iostream>
using namespace std;
int main()
{
char name[25];
cout<< "Enter a string to be display: ";
cin.get(name, 25);
cout<< "You entered a string to display is : " ;
cout<< name;
cout<< endl;
return 0;
}
Program output is tested on www.jdoodle.com
Output:
Enter a string to be display: Mukesh Rajput
You entered a string to display is : Mukesh Rajput
Thanks
Mukesh Rajput
Hello
ReplyDeleteYou have any idea how to integrate jdoodle compiler API in java web app