#include #include #include using namespace std; void WritingAFile(); void ReadingAFile(); void SwitchExample(); int main() { //WritingAFile(); //ReadingAFile(); SwitchExample(); system("PAUSE"); } void WritingAFile() { fstream myfile; cout << "Creating a file" << endl; myfile.open("c:\\documents and settings\\open\\desktop\\hello.txt", ios::out); myfile << "Hello all you martians\n"; myfile << "It is a good day on Mars\n"; myfile.close(); cout << "file is written" << endl; } void ReadingAFile() { fstream myfile("c:\\documents and settings\\open\\desktop\\hello.txt", ios::in); string line; if (myfile.is_open()) { while (! myfile.eof()) { getline(myfile, line); cout << line << endl; } myfile.close(); } else { cout << "Could not open the file" << endl; } } void SwitchExample() { int number=0; while (number != 5) { cout << "Enter a number from 0 to 4. 5 to Exit" << endl; cin >> number; switch(number) { case 0: cout << "F"<=1 && number <=3) { cout<< "Winter" << endl; } else if (number >=4 && number <=6) { cout << "Spring" << endl; } else if (number >=7 && number <=9) { cout << "Summer" <=10 && number<=12) { cout << "Autumn" <