// File Name: ~ftp/pub/class/cplusplus/Structure/StrucSimple.cpp
// Purpose: Demonstrates the use of structure in C++.
// Stores some personal data in a structure, then prints
// the info out.
#include <iostream>
using namespace std;
int main()
{
// Defining a structure
struct PersonalData
{
char *FirstName;
char *LastName;
char *Birthday; // in the format of 12/30/1978
int PhoneNum;
}; // don't forget the ending ";"
// Declaring a variable of type PersonalData
PersonalData PersonOne;
// Populate PersonOne with data
PersonOne.FirstName = "John";
PersonOne.LastName = "Doe";
PersonOne.Birthday = "12/30/1978";
PersonOne.PhoneNum = 5855555;
// Print the data out
cout << "PersonOne's First name is: " << PersonOne.FirstName << endl;
cout << "PersonOne's Last name is: " << PersonOne.LastName<< endl;
cout << "PersonOne's Birthday is: " << PersonOne.Birthday<< endl;
cout << "PersonOne's Phone number is: " << PersonOne.PhoneNum<< endl;
return 0;
}
che_che
-4
Newbie Poster
William Hemsworth
commented:
Don't waste peoples time.
-2
mvmalderen
commented:
Compile it yourself!!
-2
Recommended Answers
Jump to PostErm do we look like an online compiler service?
Jump to Postche_che
Check out the programs comments..
// Stores some personal data in a structure, then prints
// the info out.I guess that's what the output will be.
Jump to Postreally i have problems compiling?? on google i dont really understand..
You have no idea what you are doing, do you? Let me introduce you to programming. You write code in something called a computer language. A computer language is a mathamatical and logical language to tell the computer what …
All 10 Replies
iamthwee
mvmalderen
commented:
Nope, Daniweb isn't :P
+11
serkan sendur
commented:
you are just another Narue fan
+4
Sky Diploma
571
Practically a Posting Shark
Salem
commented:
Did they write it? hell no, it doesn't look like they even read it!
+36
daviddoria
334
Posting Virtuoso
Featured Poster
u8sand
68
Junior Poster
csurfer
422
Posting Pro
Hiroshe
499
Posting Whiz in Training
che_che
-4
Newbie Poster
Hiroshe
499
Posting Whiz in Training
che_che
-4
Newbie Poster
Agni
370
Practically a Master Poster
Featured Poster
Salem
commented:
simpler => closer to the machine => have to think more => harder :)
+36
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.