r/ProgrammerHumor • • 12d ago

Meme cppythRusGoSharp

Post image
314 Upvotes

36 comments sorted by

View all comments

0

u/stillalone 12d ago

Can someone tell me how to write c++ now?  Im like really confused 

1

u/A_72_ 11d ago

Version 1 - The Classic:

#include <iostream>

int main()
{
    std::cout << "Hello world!";
    return std::cout.fail();
}

Version 2 - The Modern Way:

import std;

int main()
{
    try
    {
        std::print("Hello world!");
    }
    catch (std::exception const&)
    {
        return 1;
    }
}