正在加载图片...
1.7.2采用函数成员实现格式化输出 float davl day2. total cout<<"输入第1天和第2天的销售量:"; cin >> dayl > day2 total=dayl day2 【例113】使用| cout. precision((2 函数成员实现格 cout. setf(ios: fixed ios: showpoint) cout<<"第1天 式化输出。 cout width ( 8); cout<< dayl < end cout<<"第2天 cout width(8) 见1-13.cpp cout < day2 < endl; cout<<"总和:"<setw(8)< total<<endl14 1.7.2 采用函数成员实现格式化输出 float day1, day2, total ; cout << "输入第1天和第2天的销售量:" ; cin >> day1 >> day2 ; total = day1 + day2; cout.precision ( 2 ); cout.setf(ios::fixed | ios::showpoint); cout << "第 1 天:" ; cout.width(8); cout << day1 << endl ; cout << "第 2 天:" ; cout.width(8); cout << day2 << endl ; cout << "总和:"<< setw(8) << total << endl ; 【例1-13】使用 函数成员实现格 式化输出。 见1-13.cpp
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有