Thursday, June 12, 2014

C++ Beginners Tutorial 23 - Data structures or struct (C++)

2:37 PM











1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>
#include <cstring>
using namespace std;

struct Books
{
char name[50];
char auther[50];
int id;

};

int main()
{

struct Books book1;

strcpy(book1.name,"C++ tutorials");
strcpy(book1.auther,"ProgrammingKnowledge");
book1.id=1;

cout<<"Book 1 name: "<<book1.name<<endl;
cout<<"Book 1 auther: "<<book1.auther<<endl;
cout<<"Book 1 id: "<<book1.id<<endl;

return 0;
}




















----------------------------------------------------------

Searches related to c++ structure

c++ structure example

c++ structure initialization

c++ structure array

c++ structure constructor

c++ structure definition

c++ structure vs class

c++ structure alignment

c++ structure padding

Written by

We are one of the initiators of the development of information technology in understanding the need for a solution that is familiar and close to us.

0 comments:

Post a Comment

 

© 2013 Klick Dev. All rights resevered.

Back To Top