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

/*
 *  Writing to and reading from strings.
 */

void test01()
{
  cout << "Reading a value in from a string." << endl;

  stringstream ss("1.3");

  float x;
  ss >> x;
  cout << "x=" << x << endl;
}


void test02()
{
  cout << "Writing a value to a string." << endl;

  stringstream ss;
                                                                                
  float w = 1.3;
                                                                                
  ss << w;
                                                                                
  string s = ss.str();
                                                                                
  cout << s << endl;
}

int main()
{
  test01();
  test02();
 
  return 0;
}


