Monday 12 April, 2010

hash include pfstream

//this was conceptualized waaaay back in 12th std when we were learning about filestreams in c++. Sitting with Ishan, I'd have to say this was my form of doodling. I can't find the original 'doodle', so I suppose this reconstruction'll just have to do.
//dedicated to Ishan Gupta.

// This is particularly for those who have done some c++ coding.
/*
A brief recap: iostream.h is the header where you get cin, cout, and to define your own istreams (input streams) and ostreams (o/p streams).
Further, fstream.h includes iostream.h and has the important ifstream, ofstream and fstream objects (i/p file stream, o/p file stream, file streams) which help in file handling in c++.
pfstream.h further includes fstream.h. According to some, it should rather have been called pffstream.h, but the author of the header apparently thought, as do I, that pfstream had a better ring to it. pfstream is about a particular kind of file stream, as the following sample programs shall demonstrate.
*/


//Short program to emulate Satan's Kingdom
#include <pfstream.h>
void main()
{
pfstram pf1 = new pfstream("Hell"); //step1: make the object 'Like Hell'
pf1.controls.set("The Heart Of The Sun"); //step2: Set The Controls For The Heart Of The Sun (the heat of hell)
pf1.run(); //step3: Run Like Hell
}



//Short program to cheer you up
#include <pfstream.h>
void main()
{
pfstream pf2;
cout << "Enter list of favourite colours";
cin >> pf2.colour; //step2: get Any Colour You Like
if(pf2.colour == blue)
{
cout << "Answer the following questions to win the jackpot." <<endl ;
cout << "Do you care if the sun does shine?" <<endl ;
cout << "Do you care if nothing is yours?" <<endl ;
cout << "Do you care if you're nervous with me?" <<endl ;
cout << "Will you do your loving outside the winter?" <<endl ;
cin >> pf2.answers;
if(pf2.answers == "NO")
cout << "Thank you for choosing the colour blue. And for answering the questions correctly, you have won the jackpot. May it cheer you up from your (jugband) blues." <<endl ;
}
}



//Short program for animal rights
#include <pfstream.h>
void main()
{
pfstream pf3;
pf3 = new pf3("Animals");
switch(pf3.animal)
{
case sheep:
if(pf3.tools == "Bright knives") pf3.animal.soul.release(); //With bright knives he releaseth my soul
break;
case dogs:
pf3.animal.war.loose(); //Let loose the dogs of war
break;
case tigers:
do
{
}while(!pf3.animal.free);
pf3.ground.frost=true; //There was frost in the ground when the tigers broke free
break;
}
}




/* After this tutorial, I am sure you would have gotten the gist of how to use pfstream. If you find any new innovative means of using it, please drop me a mail (or comment), so that I might add it to this tutorial with offering due credit. */

3 comments:

  1. nicely done dude. as elegant as ever.

    ReplyDelete
  2. vn. much of it familiar, yet not.

    ReplyDelete
  3. @gainda: "as elegant 'as ever'"??? Isn't that a contradiction to what you felt about my previous post? :P

    @lowprof: I'm thinking of adding a few more 'short programs' if I can. Seriously need to set those creative juices flowing!

    ReplyDelete