Put the following code before int main()
:
using namespace std;
And you will be able to use cout
.
For example:
#include<iostream> using namespace std; int main(){ char t = 'f'; char *t1; char **t2; cout<<t; return 0; }
Now take a moment and read up on what cout is and what is going on here: http://www.cplusplus.com/reference/iostream/cout/
Further, while its quick to do and it works, this is not exactly a good advice to simply add using namespace std;
at the top of your code. For detailed correct approach, please read the answers to this related SO question.
Related Posts:
- ‘cout’ was not declared in this scope
- outputting ascii table in C++
- How do I print out the contents of a vector?
- How to read a file line by line or a whole text file at once?
- streambuf::xsgetn and state flags
- C++ table alignment – cout and iomanip
- Why would we call cin.clear() and cin.ignore() after reading input?
- undefined reference to ‘std::cout’
- ‘printf’ vs. ‘cout’ in C++
- Reading from text file until EOF repeats last line
- how to print a string to console in c++
- Why I cannot cout a string?
- cin.eof() functionality
- C++ printing boolean, what is displayed?
- The difference between cin.ignore and cin.sync
- How to print (using cout) a number in binary form?
- Xcode 11.1: iostream’ file not found
- What’s the difference between while(cin) and while(cin >> num)
- operator << must take exactly one argument
- How to solve “Unresolved inclusion:
” in a C++ file in Eclipse CDT? - How to create a dynamic array of integers
- Making my own toString() method on c++ struct
- Struct Constructor in C++?
- What is meant with “const” at end of function declaration? [duplicate]
- What’s the C++ version of Java’s ArrayList
- What is the difference between “long”, “long long”, “long int”, and “long long int” in C++?
- What are the rules of the std::cin object in C++?
- ‘g++’ is not recognized as an internal or external command, operable program or batch file
- How do I convert a double into a string in C++?
- How to create timer events using C++ 11?
- How to concatenate two strings in C++?
- ‘g++’ is not recognized as an internal or external command, operable program or batch file
- error: lvalue required as unary & operand
- What is use of c_str function In c++
- Is there a decent wait function in C++?
- What does T&& (double ampersand) mean in C++11?
- C++ – No matching member function for call to ‘push_back’
- error: lvalue required as unary & operand
- C/C++ JSON parser
- C++ Parsing input string to variables
- What is the difference between const int*, const int * const, and int const *?
- How to convert a single char into an int [duplicate]
- Using O_RDWR vs O_RDONLY | O_WRONLY
- How to implement the factory method pattern in C++ correctly
- c++ array – expression must have a constant value
- getline() does not work if used after some inputs
- Passing a 2D array to a C++ function
- ‘typeid’ versus ‘typeof’ in C++
- Fatal error: iostream: No such file or directory in compiling C program using GCC
- Thread pooling in C++11
- Callback functions in C++
- How does std::forward work? [duplicate]
- Examples of good gotos in C or C++
- Undefined reference to class constructor, including .cpp file fixes
- Deleting a dynamically allocated 2D array
- How to add element to C++ array?
- Difference of keywords ‘typename’ and ‘class’ in templates?
- Error: Jump to case label in switch statement
- What does int & mean
- Split a string into an array in C++
- splitting a string into an array in C++ without using vector
- Remove spaces from std::string in C++
- How to use glOrtho() in OpenGL?
- error: ‘ostream’ does not name a type
- Remove spaces from std::string in C++
- What is the preferred way to include error messages in C++?
- How to Convert a C++ String to Uppercase
- C++ Fractions Class
- #pragma once vs include guards?
- Debug vs Release in CMake
- C++ Remove punctuation from String
- prototype for “….” does not match any in class “…”
- Cannot open Windows.h in Microsoft Visual Studio
- Reference to non-static member function must be called
- Call to non-static member function without an object argument compiler error
- How can I assign an array from an initializer list?
- I get this error: “glibc detected”
- How can I get and use the header file
in my C++ program? - Implementing a tree in C++
- Drawing Circle with OpenGL
- Run-Time Check Failure #2 – Stack around the variable ‘foo’ was corrupted
- How to implement “Press Any Key To Exit”
- Reading and writing binary file
- got “cannot appear in a constant-expression” when using template
- C++ ostream and ofstream conversions
- C++ discards qualifiers
- What is the source of the data for the ProgramFiles, ProgramW6432Dir, ProgramFilesDir (x86), CommonProgramFiles environment variables?
- C++ : Exception occurred in script: basic_string::_S_construct NULL not valid
- non-member function cannot have cv-qualifier
- too many initializers for ‘int [0]’ c++
- Multiple inputs on one line
- Why do I get: -9223372036854775808
- Return a 2d array from a function
- Linker error: “linker input file unused because linking not done”, undefined reference to a function in that file
- What is the difference among ios::app, out, and trunc in c++?
- Where can I find ‘winmm.lib’ (I’m using Visual Studio 2012)
- What is a `char*`?
- Does static constexpr variable inside a function make sense?
- “Incomplete type not allowed ” when creating std::ofstream objects
- Getting the error floating point exception: 8