Showing posts with label manipulators. Show all posts
Showing posts with label manipulators. Show all posts

Monday, 20 October 2014

Program Of Get Manipulator In C++

#include<iostream.h>
#include<conio.h>
 main()
 {
 clrscr();
 const int max=40;
 char str[max];
 cout<<"\n enter string=";
 cout<<"string is="<<str;
 getch();
 }

Friday, 27 April 2012

Program Of Set Precision Manipulator In C++

#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<iomanip.h>
#include<stdio.h>
main()
{
clrscr();
float n;
cout<<"Enter Value of n=";
cin>>n;
cout<<"\n--------------------------------------------------------------\n";
cout<<setw(5)<<"num"<<setw(16)<<"SQR(HEX Form)"<<setw(12)<<"sqrt";
cout<<setw(15)<<"SQR-SCR";
cout<<"\n---------------------------------------------------------------\n";
cout.setf(ios::showpoint);
for(int j=1;j<=n;j++)
{
cout<<setw(5)<<j
<<setw(8)<<setiosflags(ios::hex)
<<setw(8)<<j*j
<<setw(20)<<setprecision(2)<<sqrt((double)j)
<<setw(20)<<setprecision(3)<<setiosflags(ios::scientific)
<<sqrt((double)j);
cout<<resetiosflags(ios::hex);
cout<<resetiosflags(ios::scientific)<<"\n" ;
}
getch();
}


Sunday, 15 January 2012

Program Of Putback Manipulator In C++

#include<iostream.h>
#include<conio.h>
main()
{
clrscr();
char ch;
cout<<"press f6 or ^z to exit=";
while(cin.get(ch))
{
cin.putback(toupper(ch));
cin.get(ch);
cout.put(ch);
}
getch();
}

Thursday, 12 January 2012

Program Of Setwidth Manipulators In C++

#include<iostream.h>
#include<conio.h>
main()
{
clrscr();
cout.fill('-');
cout<<"There is a man"<<endl;
cout.fill('-');

   cout.width(8);
cout<<" There is a man"<<endl;
getch();

}

Program Of Delimiter Manipulators In C++

#include<iostream.h>
#include<conio.h>
 main()
 {
 clrscr();
 const int max=80;
 char str[max];
 cout<<"\n enter string=";
 cin.get(str,max,'*');
 cout<<"string is="<<str;
 getch();
 }

----------------------------------------------


Delimiter Manipulator is used to provide or give the space before the output .Simply its the part of manipulators