Skip to content

Instantly share code, notes, and snippets.

@freakflames29
Created April 21, 2021 16:12
Show Gist options
  • Save freakflames29/d1ba6e54eee44a1d6be74fe08066f7d0 to your computer and use it in GitHub Desktop.
Save freakflames29/d1ba6e54eee44a1d6be74fe08066f7d0 to your computer and use it in GitHub Desktop.
nested structure in c++
#include<iostream>
using namespace std;
struct Read
{
string areyou;
struct Book
{
string name;
struct Price
{
int price;
}prices;
}books;
}reads;
int main()
{
reads.books.name="rework";
reads.books.prices.price=500;
cout<<"Bookname: "<<reads.books.name<<endl;
cout<<"Price: "<<reads.books.prices.price<<endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment