#include <iostream>
#include <string>
using namespace std;

int main() 
{
  string a, b, c;
  string file("myfile");
  a = "qwertyasdfgzxcvb";
  b = 'x'; //char is converted to string
  c = "other thing";

  //compare two strings
  if (a == b)
    cout << "They are equal" << endl;
  else if (a < b)
    cout << a << " comes first in the dictionary" << endl;

  //append strings
  b = a + c;

  //append at end
  a += ".";

  //get the number of characters in the string
  cout << a.size();

  //find a substring
  string::size_type pos = a.find("d");
  //pos is the position of the FIRST d in string a

  //find the second d, starting at a position 1 beyond
  //the last one.
  pos++;
  string::size_type pos2 = a.find("d",pos);

  //If find does not find anything it returns string::npos
  if (pos2 == string::npos)
    cout << "Not found" << endl;

  //get the substring that starts at position pos, and
  // ends at pos2  (i.e. has length pos2 - pos)
  string subs = a.substr(pos, pos2-pos);

  //read a hole line from an istream
  getline(cin, a);

  //read until the istream is is empty
  string line;
  while (getline(is, line)) {};

  //returns the C-style string (needed for backwards compatability)
  char * s = a.c_str();
}