Inputs and outputs strings with gets_s and puts - C++ Data Type

C++ examples for Data Type:char array

Description

Inputs and outputs strings with gets_s and puts

Demo Code

#include <iostream>
using namespace std;
#include <stdio.h>
#include <string.h>
void main()//ww w  .j av a 2  s .  c o m
{
   char book[30];
   cout << "What is the book title? ";
   gets_s(book);                     // Get an input string.
   puts(book);                     // Display the string.
   cout << "Thanks for the book!\n";
   return;
}

Result


Related Tutorials