All pastes #101780 Raw Edit

Stuff

public cpp v1 · immutable
#101780 ·published 2006-07-27 04:40 UTC
rendered paste body
#include <iostream>#include <string>#include <fstream>using namespace std;int readfile(void);int main(int argc, char *argv[]){	int choice = 0;	cout<< "Press 2 to show hello world!: Press 3 to show hello name from a file, and press 1 to show the menu again"<<endl;	cin>>choice;	switch (choice)	{	case 1:		cout<< "Press 2 to show hello world!: Press 3 to show hello name from a file, and press 1 to show the menu again"<<endl;			case 2:		cout<< "Hello World! "<<endl;		case 3:		readfile();			case 4:		break;						}	}int readfile(void)	{			ifstream fin;		string name = "";		fin.open ("helloworld.txt");		if (fin.fail())		{			cout<<"Error could not open file!" <<endl;		}		getline(fin, name);		if (name == "")		{			cout<< "Hello World!"<<endl;		}		else 		{			cout<< "Hello " << name << "!" << endl;		}		fin.close();		return 0;	}