CHAPTER6-9.cpp
上传用户:fjc899
上传日期:2007-07-03
资源大小:187k
文件大小:1k
- //文件名:CHAPTER6-9.cpp
- #pragma warning(disable:4786)
- #include <iostream.h>
- #include <string>
- #include <vector>
- #include <algorithm>
- using namespace std;
- PrintIt (char* & StringToPrint) { cout << StringToPrint << endl; }
- void main (void)
- { vector<char* > FruitAndVegetables;
- FruitAndVegetables.push_back("carrot");
- FruitAndVegetables.push_back("pumpkin");
- FruitAndVegetables.push_back("potato");
- FruitAndVegetables.push_back("apple");
- FruitAndVegetables.push_back("pineapple");
- for_each (FruitAndVegetables.begin(), FruitAndVegetables.end(), PrintIt);
- }