C++ Output Methods

The following program shows and explains various methods to get output using C++

* Featured Code Example Created and submitted by LONGTIE via Sololearn.


#include <iostream>
using namespace std;

int main() {
cout << "since cstdio is included in iostream.\nputs, printf, and cout can all be used for output." << endl << endl;

puts("using puts: puts adds a new line after being ran. it might be recognized from C , where it is used for input and output.\n");

printf("using printf: printf is most commonly recognized from the c language. it dose not add a new line after being ran, this can be fixed using \\n at the end of a sentence within the quotation marks.\n");

cout << endl;
cout << "using cout: cout is most commonly used. It dose not add a new line after being used, this can be resolved with <:

< endl at the end, or as previously shown \\n at the end of the sentence.";

return 0;

Click here to run this code

More Free Code Examples:


Popular posts from this blog

Free Webstore