C++ Programming Blog

 
 
 

Image

#include <iostream.h>
#include <iomanip.h>
#include <conio.h>

void main()

{

clrscr();

cout<<\"\\t0 - 7 ARE LIGHT COLORS\\n\\n\";

cout<< \"\\t0 - 14 ARE DARK COLORS\\n\\n\\n\";

cout<<\"\\nEnter value of TEXTCOLOR:-\";

int tc;

cin>>tc;

cout<<\"Enter value of TEXTBACKGROUND:-\";

int tb,i=0;

cin>>tb;

clrscr();

textbackground(tb);

textcolor(tc);

clrscr();

cout<<\"|\";

for(i=0;i<39;i++)

{

cout<<\"--\";

}

cout<<\"|\";

cout<<\" \";

for(i=0;i<15;i++)

cout<<\"=\";

cout<<\"Program to display text as right aligned\";

for(i=0;i<15;i++)

cout<< \"=\";

cout<<endl;

cout<<\"|\";

for(i=0;i<39;i++)

{

cout<<\"--\";

}

cout<<\"|\";

char name[50];

cout<<\"\\n\\nEnter Anything to Align it Right:-\";

cin>>name;

cout<<endl<<endl;

cout<<setw(80) <<name<<endl;

getch();

}