Advertisement
Guest User

qrax

a guest
Jan 3rd, 2009
428
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. class Cowsay {
  5.    
  6.     public:
  7.         Cowsay() : cowsay(""), dashLength(""){}
  8.         ~Cowsay(){}
  9.     void printCow()
  10.     {
  11.         using namespace std;
  12.         cout << "--" << dashLength << "--" << endl;
  13.         cout << "< " << cowsay << " >" << endl;
  14.         cout << "--" << dashLength << "--" << endl;
  15.         cout << "  |  ^__^" << endl;
  16.         cout << "   - (oo)|_______" << endl;
  17.         cout << "     (__)|       )/|/" << endl;
  18.         cout << "         ||----w |" << endl;
  19.         cout << "        ||     ||" << endl;
  20.     }
  21.     void getInput(const int &argc, char **argv)
  22.     {
  23.         for(int i=1;i<argc;i++){
  24.             cowsay+=(std::string)argv[i];
  25.             int lenArgv = strlen(argv[i]);
  26.             for(int j=0;j<lenArgv;j++)
  27.                 dashLength+="-";
  28.             if(i+1<argc){
  29.                 cowsay+=" ";
  30.                 dashLength+="-";
  31.             }
  32.         }  
  33.     }
  34.     private:
  35.        
  36.         std::string cowsay;
  37.         std::string dashLength;
  38. };
  39.  
  40. int main(int argc, char* argv[]){
  41.     Cowsay cowsay;
  42.     cowsay.getInput(argc, argv);
  43.     cowsay.printCow();
  44.     return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement