How to avoid typing std::cout in C++

1 Answer

0 votes
#include <iostream>

using std::string;
using std::cout;

class Test {
    private: 
        string m_s = "C++";
    public:
        void Print() const {
            cout << m_s;
        }
            
    
};

int main() {
    Test t;
    
    t.Print();
}




/*
run:

"C++"

*/

 



answered Feb 26, 2022 by avibootz

Related questions

1 answer 228 views
228 views asked Feb 26, 2022 by avibootz
1 answer 200 views
2 answers 230 views
230 views asked Feb 21, 2022 by avibootz
3 answers 447 views
2 answers 388 views
1 answer 342 views
...