String in C++ | How we use String in C++

# include <iostream>
// add the library for the string
#include <string>


using namespace std;

void main()
{
       // this method is only for get the input from user (this method is ideal when there is no space in the string)
       char name[1000];
       cout << "Please enter your name(without space): ";
       cin >> name;
       cout << "Your entered name is: " << name << endl;

       // this method is use when variable is initialize before the use
       string name2 = "Syed Ali Haider";
       cout << name2 << endl;

}

Comments

Popular posts from this blog

Umbrella activities in Software Engineering

Operating System | Best Definition of Opetating System