By naming your sourcefile with the.c extension you force the compiler to perform C compilation and Dev-C ti use C compilation settings. Dev-C's C compilation settings do not include the C backward compatibility directory (for obvious reasons), and, and even if it did the iostream.h header file would not compile as C code. Hi, I am using Dev-C to teach C at my university. The first examples I discuss in class are very very simple (like hello word). Anyway I would like to show the output. Unfortunately, Dev-C close immediately the output window. I did not find any options to change this behaviour.
Language | ||||
Standard Library Headers | ||||
Freestanding and hosted implementations | ||||
Named requirements | ||||
Language support library | ||||
Concepts library(C++20) | ||||
Diagnostics library | ||||
Utilities library | ||||
Strings library | ||||
Containers library | ||||
Iterators library | ||||
Ranges library(C++20) | ||||
Algorithms library | ||||
Numerics library | ||||
Input/output library | ||||
Localizations library | ||||
Regular expressions library(C++11) | ||||
Atomic operations library(C++11) | ||||
Thread support library(C++11) | ||||
Filesystem library(C++17) | ||||
Technical Specifications |
I/O manipulators | ||||
C-style I/O | ||||
Buffers | ||||
(deprecated in C++98) | ||||
(C++20) | ||||
Streams | ||||
Abstractions | ||||
File I/O | ||||
String I/O | ||||
Array I/O | ||||
(deprecated in C++98) | ||||
(deprecated in C++98) | ||||
(deprecated in C++98) | ||||
Synchronized Output | ||||
(C++20) | ||||
Types | ||||
Error category interface | ||||
(C++11) | ||||
(C++11) |
How To Use Iomanip In C++
Floating-point formatting | ||||||||||||||||
| ||||||||||||||||
Integer formatting | ||||||||||||||||
Boolean formatting | ||||||||||||||||
Field width and fill control | ||||||||||||||||
Other formatting | ||||||||||||||||
Whitespace processing | ||||||||||||||||
Output flushing | ||||||||||||||||
|
| |||||||||||||||
Status flags manipulation | ||||||||||||||||
Time and money I/O | ||||||||||||||||
| ||||||||||||||||
Quoted manipulator | ||||||||||||||||
(C++14) |
/*unspecified*/ setprecision(int n ); |
When used in an expression out << setprecision(n) or in >> setprecision(n), sets the precision
parameter of the stream out
or in
to exactly n
.
[edit]Parameters
n | - | new value for precision |
[edit]Return value
Returns an object of unspecified type such that if str
is the name of an output stream of type std::basic_ostream<CharT, Traits> or an input stream of type std::basic_istream<CharT, Traits>, then the expression str << setprecision(n) or str >> setprecision(n) behaves as if the following code was executed:
str.precision(n);
[edit]Example
Output:
[edit]See also
Why We Use Iomanip In C++
(C++11)(C++11) | changes formatting used for floating-point I/O (function)[edit] |
manages decimal precision of floating point operations (public member function of std::ios_base )[edit] |