Structures in C++

By Prem Tiwari in C++ Tutorial. Updated on


In this tutorial, I will explain how to use the Structures in c++ programming language. This tutorial will explain you about the Structures in C++ program. After going through of this tutorial, you will able to know:

  1. What is a structure in C++?
  2. How to declare structures in C++?
  3. How to write a program using structures in C++?

What is a structures in C++

The structure is a collection of variables of different data types in a single variable name. It is just like of similar to the class, it holds the collection of data types.

How to declare structures in C++

Below example will show you declare structures in C++ in your program.

How to write a program using structures in C++?

Below program will take input as your full name, your age, and your salary, then this program will print the output as:

Copy and paste below program and execute it to better under standing of structure in C++ programming language.

Output:

Enter your full name: Prem Tiwari
Enter your age: 29
Enter your salary: 30000
**********************************
Input Information.
Name: Prem Tiwari
Age: 29
Salary: 30000

Sharing is caring!


Prem Tiwari

An engineer by profession and a passionate blogger by heart. Founder of FreeWebMentor.com (A Programming blog for beginners), Tech Speaker at various forums. A part from this he is an open source enthusiast, WordPress Lover, Blogger, SEO, and Growth Strategic.

You might also like:

Tags: , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.