OUTPUT
USING THE COUT OBJECT -
As discussed earlier the cout object, together with the << operator, is used to output values/print text.
You can add as many cout objects as you want. However, note that it does not insert a new line at the end of the of each object all of them will be printed in a single line.
#include <iostream>
using namespace std;
int main() { cout << "Demo Code.";
cout << "I am learning C++.";
cout << "Print text.";
return 0;
}
Output:
Demo Code.I am learning C++.Print text.
NEW LINE.
In order to insert a new line after each object declaration \n is used. Or another way to do so is using end1 manipulator.
EXAMPLE -
#include <iostream>
using namespace std;
int main() {
cout << "Demo Code.\n";
cout << "I am learning C++" <<end1;
cout << "print text";
return 0;
}
Output:
Demo Code. I am learning C++ print text

Comments
Post a Comment