forked from Mugdha-Hazra/hackerrank-solution
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasic data types.cpp
More file actions
35 lines (28 loc) · 889 Bytes
/
Basic data types.cpp
File metadata and controls
35 lines (28 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//Basic Data Types.
#include <iostream>
#include <iostream>
#include <cstdio>
#include<iomanip>
using namespace std;
int main()
{
int a;
long b;
char c;
float d;
double e;
cin >> a >> b >> c >> d >> e;
cout << a << "\n" << b << "\n" << c << "\n";
cout << std::fixed << std::setprecision(3) << d << '\n';
cout << std::fixed << std::setprecision(9) << e << '\n';
return 0;
}
/*function
<iomanip>
std::setprecision
setprecision(int n);
1)Set decimal precision
2)Sets the decimal precision to be used to format floating - point values on output operations.
3)Behaves as if member precision were called with n as argument on the stream on which it is inserted / extracted as
a manipulator(it can be inserted / extracted on input streams or output streams).
4)This manipulator is declared in header <iomanip>.*/