Tag Archives: C++

C++ Read from a file using fstream

/** Read from a file (version 1) Copyright 2009 Travis Crowder travis.crowder@spechal.com Published under the MIT License */ #include <iostream> #include <fstream> #include <string> int main(int argc, char* argv[]){ // create the file handle, opening the file std::fstream myFile("text.txt", std::ios::in); … Continue reading

Posted in C++ | Tagged | Leave a comment

C++ Palindrome Checker

/** Palindrome Checker Copyright 2009 Travis Crowder Published under the MIT License */ #include <iostream> #include <algorithm> #include <string> bool isPalindrome(const std::string theWord); int main(int argc, char* argv[]){ std::string theWord; if(!argv[1]){ std::cout << "Enter the word to check: "; std::cin … Continue reading

Posted in C++ | Tagged | Leave a comment