Wednesday, 2024-04-24, 8:46 AM
ebooks Programming Computer Science
Welcome Guest | RSS
Site menu
Section categories
My articles [23]
Main » Articles » My articles

String Initialization without equal (=) Sign
#include<iostream>
#include<string>
using namespace std;
 
int main()
{
     string hi("What's your name?"),             //string hi="What's your name?",
              name,
              line(40,'-');
 
     cout << hi << endl;
     cout <<line << endl;
     cout << "My name is ";
     getline(cin,name);
     cout <<"hey " << name <<"!"
          <<"Your name has " <<name.length()<<" characters" << endl
 <<line << endl;
 
     return 0;
}
Category: My articles | Added by: Sumrat (2012-09-17)
Views: 34760 | Rating: 0.0/0
Total comments: 0
Name *:
Email *:
Code *:
Our poll
Rate my site
Total of answers: 164
Statistics

Total online: 1
Guests: 1
Users: 0
Login form