-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathANOTHER_Practice_Program.cpp
More file actions
63 lines (45 loc) · 1016 Bytes
/
ANOTHER_Practice_Program.cpp
File metadata and controls
63 lines (45 loc) · 1016 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include<stdio.h>
#include<iostream.h>
#include<conio.h>
struct student //define structure
{
int age;
char name[20];
float marks;
};
main()
{
int i;
int arr[2];
struct student x,z;
struct student y[2]; //member declaration
clrscr();
//working with simple var of structure
cout<<"Enter Name of x ";
cin>>x.name; //access data through dot operator
cout<<"Enter Age of x ";
cin>>x.age;
cout<<"Enter Marks of x ";
cin>>x.marks;
cout<<x.name<<" "<<x.age<<" "<<x.marks;
cout<<"Enter Name of z ";
cin>>z.name; //access data through dot operator
cout<<"Enter Age of z ";
cin>>z.age;
cout<<"Enter Marks of z ";
cin>>z.marks;
cout<<z.name<<" "<<z.age<<" "<<z.marks;
//working with array
for(i=0;i<2;i++)
{
cout<<"\nEnter Name of y["<<i<<"] ";
cin>>y[i].name;
cout<<"\nEnter Age of y["<<i<<"] ";
cin>>y[i].age;
}
for(i=0;i<2;i++)
{
cout<<y[i].name<<" "<<y[i].age<<endl;
}
getch();
}