Program to show database of student in C++

// Program to show database of student in C++
#include <iostream.h>
#include <conio.h>
int main()
{
 // Defining a structure
 struct student
 {
char *FirstName;
char *LastName;
char *Birthday;  // in the format of 12/30/1978
int  Age;
 }; // don't forget the ending ";"

 // Declaring a variable of type student data
 student stu;

 // Populate stu with data
 stu.FirstName = "John";
 stu.LastName = "Doe";
 stu.Birthday = "12/30/1978";
 stu.Age = 18;

 // Print the data out
 cout << "Student's First name is: " << stu.FirstName << endl;
 cout << "Student's Last name is: " << stu.LastName<< endl;
 cout << "Student's Birthday is: " << stu.Birthday<< endl;
 cout << "Student's Age is: " << stu.Age<< endl;

 getch();
}
Expected Output:



Post a Comment

Previous Post Next Post