Skip to content

About

C++ Stream Manipulators, Library Functions, and C-String Functions

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Stream Manipulator Temperature Table

A C++ project that generates a neatly formatted Fahrenheit-to-Celsius conversion table using standard I/O stream manipulators and stream formatting flags. This program processes user-defined temperature thresholds to compute Celsius equivalents and outputs tabular data with strict column alignment, customized field widths, and specialized numerical padding:

[Fahrenheit (Width 10)] + [Spacer] + [Celsius (+/- Sign, Zero-Padded, Width 15, 3 Decimals)]

Each output row computes the exact Celsius equivalent (F - 32) * 5.0 / 9.0, formats floating-point values to three fixed decimal places, displays an explicit plus sign (+) for positive temperatures, and aligns values cleanly under structured column headers.

Objectives

  • Stream Formatting: Mastering <iomanip> manipulators including setw(), setprecision(), and setfill() to dictate field widths and column layouts.
  • I/O Flag Management: Activating and clearing stream formatting flags with setf() and unsetf() (such as ios::fixed, ios::showpoint, and ios::showpos) to format numeric signs and decimals.
  • Mathematical Conversion: Implementing temperature conversion formulas using floating-point literals to prevent unintentional integer division.
  • Stateful Stream Control: Managing persistent versus transient stream manipulators—specifically toggling setfill(' ') and setfill('0') so that zero-padding does not bleed across adjacent columns.

Features

  • Dynamic Range Input: Prompts the user for starting and ending Fahrenheit temperatures to generate tailored conversion tables on demand.
  • Precision Decimal Display: Fixes floating-point Celsius readings strictly to three decimal places while preserving trailing zeroes.
  • Zero-Padded Field Widths: Uses customized fill characters to pad Celsius readings to a uniform width of 15 characters while preserving algebraic signs.
  • Structured Column Alignment: Prevents adjacent numbers from running together by pairing field-width justification with dedicated column spacing.

About

C++ Stream Manipulators, Library Functions, and C-String Functions

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages