Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- #include <stdlib.h>
- #include <windows.h>
- #include <conio.h>
- using namespace std;
- // A furmacao dos tipos e endicada logo apos % e antes do campo do tipo
- int main(){
- //Codigo Formatacao
- printf("%4d", 45);// No minimo 4 caracteres
- cout<<endl;
- printf("%-4d", 45);// Anterior, mas alinhado a esc7
- cout<<endl;
- printf("%04d", 45);// Completa com zeros
- cout<<endl;
- printf("%.2f", 75.777);// 2 Casas decimais
- cout<<endl;
- cout<<endl;
- cout<<endl;
- printf("%8.2f", 75.777);// Anterior, mas com 8 caracteres
- cout<<endl;
- cout<<endl;
- cout<<endl;
- printf("%-8.2f", 75.777); // Anterior, mas alinhado a esc
- return 0;
- system("pause>null");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement