Advertisement
Jambix64

SetprecisionaAndModificadoresDeTipos

Sep 25th, 2016
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <iostream>
  3. #include <stdlib.h>
  4. #include <iomanip>  
  5.  
  6. using namespace std;
  7.  
  8.  namespace var{
  9.    
  10.     unsigned int numberPositivo;
  11.     signed int NumberPN;
  12.     long double NumberLong;
  13.     short int NumberShort;
  14.    
  15.   }
  16. int main(){
  17.      
  18.     var::numberPositivo = 100;// Numeros positivos sem sinal;
  19.     var::NumberPN -1;// Numeros negativo e positivos com sinal;
  20.    
  21.     var::NumberLong  = 78048.45;// Valores longos;
  22.     var::NumberShort  = 100; // Valores curtos;
  23.    
  24.     using namespace var;
  25.    
  26.     cout<<"NumberPositivo = "<<numberPositivo<<endl;
  27.     cout<<"NumberPN = "<<   std::setprecision(8) << NumberPN<<endl;
  28.     cout<<"NumberLong = "<<NumberLong<<endl;
  29.     cout<<"NumberShort = "<<NumberShort<<endl;
  30.    
  31.     float f = 5.6;
  32.     cout<<"Testando o STDFIXED = "<<std::fixed<<f<<endl;
  33.    
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement