Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. int main(void) {
  7.     ifstream file("file.txt");
  8.     int num;
  9.  
  10.     file>>hex>>num; // Lê um valor hexa do arquivo
  11.  
  12.     cout<<num<<endl; // Exibe num na tela na base decimal mesmo
  13.     cout<<hex<<num<<endl; // Exibe num na tela na base hexa
  14.  
  15.     return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement