0

I am working on a C++ program. I saw multiple lines of logs in this pattern in one of the files:

#include <iostream>

using namespace std;

int main()
{
    std::cout << "First line"
                                                " second line" << std::endl; 

    return 0;
}

I am not very familiar with cpp language, is this a standard way of logging and how does it work? I feel like it should give some kind of syntax error on a quick look?

5

1 Answer 1

0

To log a simple string in C++ one can type std::cout << "My String.";

To log a variable one can replace "My String" from before with their variable.

to either add a string or another variable to a std::cout one can add "+ "My String"" or + MyVariable.

To end a line and begin writing to the line below one can add \n to their string.

To play a sound one can add \a to their string.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.