Studytonight is now part of the GUVI universe. Explore GUVI →
🤩 New Cool Developer Tools for you. Explore →
FREE JavaScript Video Series Start Learning →
Signup/Sign In
Tests
MCQs to test your knowledge.
Compilers
Compilers to execute code in browser.
Index
LAST UPDATED: APRIL 4, 2022

C++ Program To Print A Full String Input using Keyboard

In this tutorial, we will understand that how to write or take input a full string usig the keyboard.

Program To Print A Full String Input Using Keyboard In C++

Before moving to the implementation part ,let's first have a absic look on what is string in C++.

String is a collection of characters. There are two types of strings commonly used in C++ programming language:

  • Strings that are objects of string class (The Standard C++ Library string class)
  • C-strings (C-style Strings)
#include<iostream>
#include<string.h>
using namespace std;
int main()
{ 
 char a[20];
 int i,j;
 cout<<"\n\nEnter The String: ";
 gets(a); 
 cout<<"\n\nYour Entered String is Given Below \n\n";
 for(i=0;a[i]!='0円';++i)
 {
 cout<<a[i];
 }
 return 0;
}


Enter The String: Studytonight


Your Entered String is Given Below

Studytonight

Conclusion

Here, we have learnt the basic approach and C++ program implementation of strings that how can we input the strings using characters as a datatype.



About the author:
Nikita Pandey is a talented author and expert in programming languages such as C, C++, and Java. Her writing is informative, engaging, and offers practical insights and tips for programmers at all levels.

Learn to Code
Learn and practice coding side-by-side.
NEW
C language Course
115+ coding exercises
Javascript Course
85+ coding exercises

AltStyle によって変換されたページ (->オリジナル) /