Tuesday, July 24, 2018

C++ Console Input/Output Function

/* This file contains program related to console input and output */

#include
#include

// 1. Program shows the application of setf function for left padding
int main()
{
   cout.width(20);
   cout.setf(ios::left,ios::adjustfield);
   cout.fill('*');
   cout<<"IT";
}

//2. Program shows the application of setf function right padding
int main()
{
   cout.width(20);
   cout.setf(ios::right,ios::adjustfield);
   cout.fill('*');
   cout<<"IT";
}

//3. Program shows the application of internal
int main()
{
   cout<<-3 .15="" n="" p="">   cout.width(20);
   cout.setf(ios::internal,ios::adjustfield);
   cout.fill('*');
   cout<<-3 .15="" p="">}

//4.  Program shows the application scientific
int main()
{
   cout<<-3 .15="" n="" p="">   cout.width(20);
   cout.setf(ios::scientific,ios::floatfield);
   cout.fill('*');
   cout<<-3 .15="" p="">}


//5.  Program to print of Hexa Decimal, Octal, Decimal No.
int main()
{
    int x = 65;   
   cout.width(20);
   cout.setf(ios::hex,ios::basefield);
   cout<<"\n Hexa -> "<   cout.setf(ios::oct,ios::basefield);
   cout<<"\n Octal -> "<   cout.setf(ios::dec,ios::basefield);
   cout<<"\n Dec -> "<}

No comments:

Post a Comment

Financial Year Oracle PLSQL Program

 CREATE OR REPLACE function FINANCIAL_YEAR(p_date DATE) return varchar2 IS    v_first     varchar2(4);    v_second    varchar2(4);    v_year...