C++ string using string data type
#include <iostream>
using namespace std;
int main()
{
// Declaring a string object
string str;
cout << "Enter a string: ";
getline(cin, str);
cout << "You entered: " << str << endl;
return 0;
}
Output
Enter a string: Programming is fun. You entered: Programming is fun.
No comments:
Post a Comment
Thanks For Reading! Visit Again