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 149 views
149 views asked Feb 26, 2022 by avibootz
1 answer 91 views
2 answers 114 views
114 views asked Feb 21, 2022 by avibootz
3 answers 266 views
2 answers 242 views
1 answer 212 views
...