[ create a new paste ] login | about

Link: http://codepad.org/T98qFuig    [ raw code | output | fork ]

C++, pasted on Mar 18:
    #include <iostream> 
    #include <string>
     
    using namespace std; 
     
    void exec(string option) 
    { 
        cout << "option is " << option << endl; 
        if (option == "foo") 
            cout << "option foo"; 
        else if (option == "bar") 
            cout << "option bar"; 
        else 
            cout << "???"; 
        cout << endl; 
    } 
     
    int main() 
    { 
        string opt = "foo"; 
        exec(opt);

        exec("bar");

        char array[] = "other";
        exec(array);
        return 0; 
    } 


Output:
1
2
3
4
5
6
option is foo
option foo
option is bar
option bar
option is other
???


Create a new paste based on this one


Comments: