Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <string>
- class Cowsay {
- public:
- Cowsay() : cowsay(""), dashLength(""){}
- ~Cowsay(){}
- void printCow()
- {
- using namespace std;
- cout << "--" << dashLength << "--" << endl;
- cout << "< " << cowsay << " >" << endl;
- cout << "--" << dashLength << "--" << endl;
- cout << " | ^__^" << endl;
- cout << " - (oo)|_______" << endl;
- cout << " (__)| )/|/" << endl;
- cout << " ||----w |" << endl;
- cout << " || ||" << endl;
- }
- void getInput(const int &argc, char **argv)
- {
- for(int i=1;i<argc;i++){
- cowsay+=(std::string)argv[i];
- int lenArgv = strlen(argv[i]);
- for(int j=0;j<lenArgv;j++)
- dashLength+="-";
- if(i+1<argc){
- cowsay+=" ";
- dashLength+="-";
- }
- }
- }
- private:
- std::string cowsay;
- std::string dashLength;
- };
- int main(int argc, char* argv[]){
- Cowsay cowsay;
- cowsay.getInput(argc, argv);
- cowsay.printCow();
- return 0;
- }
- // http://forum.codecall.net/topic/44837-cowsay-c-version/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement