All pastes #89888 Raw Edit

Stuff

public cpp v1 · immutable
#89888 ·published 2006-07-17 03:50 UTC
rendered paste body
// HAL 1.3.37 by BJ#include <iostream>#include <string>#include <fstream>using namespace std;int makef(string filen);int fexists(string filen);int checkfe(string uinput, string fname);int writetf(string filen, string uinput);int main()  {		string text;	string name;	string status;		cout << "What is your name? ";	getline(cin,name);	fexists("name");				int exists = checkfe(name,"name");	if (exists == 1) {		writetf("name", name);		cout << "Nice to meet you " << name <<  "." << endl;		}	else 		cout << "Hey!, we meet again " << name  << "." << endl;		//cout << "Hello " << name << ", how are you today?  ";	//getline(cin,status);			/* if (exists == true)		cout << "I'm glad your having a good day "  << name << "." << endl;	else		cout << "I hope your day gets better " << name << "." << endl;	return 0; */ }int makef(string filen) {	string filens = filen + ".txt";	ofstream file(filens.c_str());	file << "//HAL_has_created_" << filens  << endl;	file.close();	return 0;}int fexists(string filen) {		string filens = filen + ".txt";	ifstream file(filens.c_str());	if (file) {		file.close();		return 0;	}	else {		makef(filen);		return 1;		}		}		int checkfe(string uinput, string filen) {	string filens = filen + ".txt";	bool exists = false;	string text;	fstream file(filens.c_str());			while(!file.eof() and !exists)		{		file >> text;			if (text == uinput) {			exists = true;			return 0;			}		}	return 1;	}int writetf(string filen, string uinput) {	string filens = filen + ".txt";	ofstream file(filens.c_str(),ios::app);	file << uinput << endl;	file.close();	return 0;	}