Search
 
SCRIPT & CODE EXAMPLE
 

CPP

C++ Pi 4 Decimal

   double pi = 3.14159265; // this is floating point number
   cout << fixed << setprecision(4); // number is set to display with 4 decimal places
   cout <<" The value of pi : " << pi << endl;
   cout << " The value of pi 4 decimal place of total width 8   : |" << setw(8) << pi << "|" << endl; // setw() sets the total width
   cout << " The value of pi 4 decimal place of total width 10  : |" << setw(10) << pi << "|"<< endl; 
   
   cout << setfill('-'); // setfill() sets to fill the blanks with specified character
   cout << " The value of pi 4 decimal place of total width 8   : |" << setw(8) << pi << "|" << endl; 
   cout << " The value of pi 4 decimal place of total width 10  : |" << setw(10) << pi << "|"<< endl; 
   
   cout << scientific;  // set value in scientific format with exponent
   cout <<" The value of pi in scientific format is : " << pi << endl;
   
   bool done = false; // this is boolean variable
   cout <<" Status in number : " << done << endl;  
   cout << boolalpha;     // set output in alphabet true or false
   cout <<" Status in alphabet : " << done << endl;
Comment

PREVIOUS NEXT
Code Example
Cpp :: put text on oled 
Cpp :: cyclic array rotation in cpp 
Cpp :: How to use jwt in login api in node js 
Cpp :: how to copy vector to another vector in c++ 
Cpp :: one away coding question 
Cpp :: User defined functions and variables in C++ programming 
Cpp :: text color c++ 
Cpp :: Syntax for C++ Operator Overloading 
Cpp :: resharper fold statement 
Cpp :: print reverse number 
Cpp :: c++ unittest in ros 
Cpp :: string in c++ 
Cpp :: intlen in c++ 
Cpp :: Euler constant 
Cpp :: Array declaration by specifying the size in C++ 
Cpp :: flag of georgia 
Cpp :: max heap insertion c++ 
Cpp :: swap alternate elements in an array c++ problem 
Cpp :: __builtin_popcount 
Cpp :: right shift in c++ 
Cpp :: remove linked list elements leetcode 
Cpp :: public method 
Cpp :: c++ main function parameters 
Cpp :: binary multiplication 
Cpp :: Check whether the jth object is in the subset 
Cpp :: c ++ The output should be (abc),(def),(ghw) 
Cpp :: C# adding numbers 
Cpp :: c++ round number to 2 decimal places 
Cpp :: how to pronounce beaucoup 
Cpp :: practice problems for nested loops in c++ 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =