All pastes #101760 Raw Edit

Unnamed

public cpp v1 · immutable
#101760 ·published 2006-07-27 04:25 UTC
rendered paste body
#include <iostream>#include <string>#include <fstream>using namespace std;int main(int argc, char *argv[]){	int choice = 0;	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;		break;		case 2:		cout<< "Hello World! "<<endl;		break;	case 3:		break;					}	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;	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();}