Write your question here.
i need to print to columns of temps,farenheit/celsius....ive got my decimal places lined up and everything centered(im very proud of all that!) i need to showpos and setfill for celsius column only.....
#include <iostream>
#include <iomanip>
using namespace std;
thanx but i also need plus signs for pos cels values and *s instead of spaces in front of cels values....i only know how to showpos and setfill for the whole line, cant figure out how to leave faren alone and change cels
#include <iostream>
#include <iomanip>
int main()
{
std::cout << "Farenheit Celsius\n--------- -------\n"
<< std::fixed << std::setprecision(3) ;
// for all subsequent output, fixed with three digits after the decimal point
for( int faren = 0; faren <= 212; faren += 2 ) // note: type of faren is int
{
constdouble cels = 5.0 * ( faren - 32.0 ) / 9.0;
// print faren with field width 5, space as fill character, no +sign
std::cout << std::setw(5) << std::setfill(' ') << std::noshowpos << faren
<< " "
// print cel with field width 9, '*' as fill character, with +sign
<< std::setw(9) << std::setfill('*') << std::showpos << cels << '\n' ;
}
}