Sunday, 25 July 2021

Use of \t in C++ with an example.

 Use of \t in C++

'\t' is a horizontal tab . It is used for giving tab space horizontally in your output

For example, 

Write a C++ program to display the following-

Name          Marks

Raj            76.5

Geeta          85.5

Simmy       93.5


Source code:

#include<iostream.h>

#include<conio.h>

void main()

{       clrscr();

         cout<<"Name\t\tMarks"<<endl;

         cout<<"Raj\t\t76.5"<<endl;

         cout<<"Geeta\t\t85.5"<<endl;

         cout<<"Simmy\t\t93.5"<<endl;

        getch();

}

Output:

Output

 

 

 

 

 

 

 

 

 

 

 

No comments:

Post a Comment

Program to find and display area, circumference and diameter of a circle in C++.

Write a C++ program to find and display area, circumference and diameter of a circle.  Source code: #include<iostream.h> #include<c...