fubard
By: j00 | Date: Nov 9 2007 21:11 | Format: C++ | Expires: never | Size: 988 B | Hits: 1335
- #include <iostream>
- #include <stack>
- #include <string>
- #include <fstream>
- #include <queue>
- using namespace std;
- int main()
- {
- queue<string> s;
- string word;
- ifstream in("input5.txt");
- while (getline(in,word))
- {
- s.push(word);
- }
- cout << "Number of words = " << s.size() << endl;
- while(!s.empty())
- {
- cout << s.front()<< "n";
- s.pop();
- }
- system("PAUSE");
- return 0;
- }
- /* input
- Use stack and queue, from the Standard Template Library (STL), to reverse the words in this; sentence
- esU kcats dna eueuq, morf eht dradnatS etalpmeT yrarbiL (LTS), ot esrever eht sdrow ni siht ecnetnes.
- There are 1234 letters in this essay.
- Therefore, just do it
- esU kcats dna eueuq morf eht dradnatS etalpmeT yrarbiL (LTS) ot esrever eht sdrow ni siht ecnetnes
- esU kcats dna eueuq morf eht dradnatS etalpmeT yrarbiL ot esrever eht sdrow ni siht ecnetnes
- */
Latest pastes
1 days ago
1 days ago
1 days ago
2 days ago
2 days ago