forked from rikardgn/learnCpp
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimpleStructEx.cpp
More file actions
Latest commit
30 lines (24 loc) · 567 Bytes
/
Copy pathsimpleStructEx.cpp
File metadata and controls
30 lines (24 loc) · 567 Bytes
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
28
29
30
//This example shows to declare simple structs in C++.
#include<iostream>
usingnamespacestd;
structpoint3D{
float xCrd;
float yCrd;
float zCrd;
} pnt3D;
intwrtContentsPt(point3D point1);
intmain(void){
int res;
pnt3D.xCrd = 3.5;
pnt3D.yCrd = 2.1;
pnt3D.zCrd = 1.8;
res = wrtContentsPt(pnt3D);
return0;
}
intwrtContentsPt(point3D point1){
cout << "Coordinates of the point" << "\n";
cout << point1.xCrd << "\n";
cout << point1.yCrd << "\n";
cout << point1.zCrd << "\n";
return0;
}