I can't get the full output of the name, only the first name is getting printed. And I can't input in Date structure variable that I have created inside the Visitor structure. I am just starting to learn and can't seem to find any problem with it. I ran it on both my system and online C++ compiler.
#include<iostream>
#include <string>
using namespace std;
int main() {
/* Made a Structure here to store date. */
struct Date {
int day, month, year;
};
/* A structure to store visitor details. */
struct Visitor {
string name;
Date visitday; //Structure variable of Date Structure inside Visitor Structure.
};
Visitor person; // Structure Variable of Visitor Structure.
cout << "Enter Name-";
cin >> person.name;
cout << "\nEnter Day- ";
cin >> person.visitday.day;
cout << "\nEnter Month- ";
cin >> person.visitday.month;
cout << "\nEnter Year- ";
cin >> person.visitday.year;
cout << "\nName- " << person.name << " " << "\nDay of Visit- ";
cout << person.visitday.day << "/" << person.visitday.month << "/" << person.visitday.year;
return 0;
}