C++ I/0 Stream <setf and Manipulators>
来源:互联网 发布:中文翻译英文软件下载 编辑:程序博客网 时间:2024/04/27 15:25
/* 77.6669okwari7.6669 0okwarisunsfa6+5+788 7 hello!* 123*123 * 123**/#include <iostream>#include <fstream>#include <iomanip>using namespace std;int main() { cout.width(3); cout << 7 << endl; cout.width(5); cout << 7.6669 << "okwari" << endl; cout.width(5); cout << 7.6669 << cout.width(2) << "okwari" << endl; // cout.width(2) 返回值为0;所以输出0okwari cout.width(3); cout << "sun" << endl; cout.setf(ios::showpos); // 当出现数字时自动在其前面加上一个”加号“,对字符串中的数字无效果 cout << "sfa6" << 5 << 7 << endl; cout.unsetf(ios::showpos); // 取消加号设置 cout << 88 << endl; cout << setw(3) << 7 << setw(7) << "hello!" << endl; // 使用setw()需包含头文件 iomanip cout << "*" << setw(5) << 123; cout.setf(ios::left); cout << "*" << setw(5) << 123; cout.setf(ios::right); cout << "*" << setw(5) << 123 << "*" << endl; return 0;}
0 0
- C++ I/0 Stream <setf and Manipulators>
- Stream I/O and Files
- setf ()
- 06-I/O Stream: Object and Class
- Java File I/O :Reader/Writer and when a Stream
- Java基础(十一) Stream I/O and Files
- C++stream
- PLI Stream I/O
- C++ Stream I/O
- I/O stream
- Java I/O Stream
- I/O Stream
- node.js stream I
- setf 使用方法
- setq & setf
- stl string and stream
- CUDA ---- Stream and Event
- overloading stream insertion and stream extraction operators
- webp格式图片
- Linux Makefile学习(二)
- Back Track下建立“钓鱼”热点测试
- 294 - Divisors(唯一分解定律)
- win7 64位 旗舰版 环境配置(多方学习的小总结)
- C++ I/0 Stream <setf and Manipulators>
- linux服务器操作系统的选择
- jquery如何控制一个元素的高亮显示
- Largest Number —— Leetcode(sort的妙用)
- 堆空间和栈空间的大小
- hdu1003 最大连续子序和
- 《C++primer(第五版)》学习之路-第三章:字符串、向量和数组
- TortoiseSVN对文件夹状态显示错误的问题
- 黑马程序员java之集合框架Map