Pages

Thursday, July 04, 2013

Write a program that Demonstrate fill characters in C++

Demonstrate fill characters

Input:


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
   #include <iostream.h>
   #include <conio.h>
   #include <iomanip.h>
   int main ()
   {
   float amount = 123.45;
   cout << "Demonstrate fill characters\n\n";
   cout << setw(10) <<  amount << "\tAmount with space fill \n ";
   cout << setw(10) << setfill ('*') << amount << "\tAmount cheak protection fill\n ";
   cout << setw(10) << setfill (' ') << amount << "\tand again with space fill\n\n\n\n\n";
   getch(); 
            }

Output:


Demonstrate fill characters
 123.45  Amount with space fill
    *****123.45  Amount cheak protection fill 
  123.45  and again with space fill

No comments:

Post a Comment