Tuesday, 2024-12-24, 8:53 PM
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: 34822 | Rating: 0.0/0
Total comments: 0
Name *:
Email *:
Code *:
Our poll
Rate my site
Total of answers: 164
Statistics

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